In a nutshell, my application consists of a server and a client with multiple forms. The client logs in or registers and then once logged in, it takes them to a chatroom lobby where multiple clients can send messages to eachother.

My application uses System.Net.Sockets and I manage to establish a connection and communicate, but I do not know how to terminate and reuse the connection after the client disconnects. If I close the client application and then open it again, it won't let me because I apparently didn't properly terminate the connection.

SO! Has anyone ever successfully made a socket application and can help me out?


try to have the server disconnect a client right after data arrives (500msecs later).
Don't disconnect from client side unless you want to resend sth.
If a client wants to send sth use:
1. Disconnect if state = connected
2. Send if accepted from server

Works for me, using winsock.
Hope it helps,