Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

YOU GREATS OUT THERE I NEED UR HELP!!!

Status
Not open for further replies.

codemechanic

Programmer
Apr 3, 2004
3
AU
I am using the system.net.socket class sockets to setup events and callbacks to monitor client connection status in a Time server. The socket class supports the following methods which I have used to setup onconnect and onreceivedata events:

1.sock.BeginAccept, 2.sock.BeginRecieve

The problem that I face is since there is no method that I can use to couple a "client close connection" event, how do I set up a server side event"onDisconnect" that gets fired when the client closes the connection? I need this to update the clients connection status. Is there anyway i can achieve this using the system.Net.socket class sockets or any other C# socket?
 
There are few solutions and here is one.
Design a table and store there some info about a client: guid or ip address, connection status, datetime when connected/disconnected.
When a client get successful connection with the server then add/update client and flag it as connected (flag =1) at this datetime.
When a client closes the connection then update flag=0.
When the client tries to connect but fails then add/update client and flag = -1.
Any time you can query the connected/disconected clients.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top