doubts on socket programming...

  • Thread starter Thread starter RamaKrishna
  • Start date Start date
R

RamaKrishna

Hi all,
I need to write a socket program that connects to a server
and sends a few bytes and receives some data.Is it
possible to write 2 programs (2 .exes) - one for sending
bytes and another for receiving the response from the
server for the bytes sent by the first program.The
communication between the client and server is
asynchronous.Is it possible to do so ? If not,why?
Thanks in advance.
TRK
 
Yes, it's possible, although I'm not sure what problem this would solve.
Can you elaborate? Perhaps there is a simpler way to accomplish what you're
trying to do - having two separate processes work in this manner is a little
klunky.

One way to do this is to call DuplicateHandle(), passing your socket
(process 1), and pass the duplicate handle to process 2 via some sort of IPC
mechanism (shared memory, pipe, etc.).

The problem here is that this will probably not work correctly if process 2
doesn't get the socket handle before the data from the server is received by
the IP stack. So make sure you pass the socket handle to process 2 before
you send the query to the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top