Socket Example Wanted

  • Thread starter Thread starter Anders Both
  • Start date Start date
A

Anders Both

Does anyone know of a good asynchronous socket exsample. There are some
exsamples in the documentation and around on the net. But they are all in
the same way: The server reseived a connection from the client, read
something and send something back.

A need an exsamlple were a client connect´s to a server, and then the
connection is kept up. The client can then send data to the server when ever
it whant to. But the Server can also send data to the client when ever it
want to.

The Connection can then be disconnected by the Client.

I hope someone can understand me, and se how this exsample differs from the
examples out there.

If someone can desripe how to make such a solution they are also welcome.
Dont you need to make a Thread on the server representing each client ?

Best Regards

Anders Both , Denmark.
 
Anders Both said:
Does anyone know of a good asynchronous socket exsample. There are some
exsamples in the documentation and around on the net. But they are all in
the same way: The server reseived a connection from the client, read
something and send something back.

A need an exsamlple were a client connect´s to a server, and then the
connection is kept up. The client can then send data to the server when ever
it whant to. But the Server can also send data to the client when ever it
want to.

Have you seen the example at
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconnon-blockingserver
socketexample.asp? It does disconnect from the client eventually (of
course) but not until the client signals that it is done with the
conversation by sending "<EOF>". Until that happens, it should maintain the
connection and you should be able to process multiple requests from the
client. You can pull out the disconnect code from the Send() method and put
it into it's own method so that you can make multiple responses back to the
client over the duration of the connection.
 
Thx, I saw that exsample but still I would like some more exsample. But
anyway in the meantime I am begining to understand everything.

Best Regards
 
Back
Top