Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sockets Programming(Disconnecting from Server)
#1
Okay at the moment i am coding a Server/Client program or rather i am updating an old program of mine to use Server/Client. But i am having abit of a problem with disconnecting from my server (this means if a client closes the program the server crashes)

So lets say ive called my socket on the client for

clientSocket

now what i have tried is

clientSocket.Disconnect ' This will simply Freeze the damn program, But it does disconnect the damn thing

clientSocket.Dispose ' Does the same as above freeze

So what i was wondering is if anyone has a code or a suggestion to do this

Allso since i am using a Client list on my server to see who is online and stuff (To administrate online users)

Once the user has disconnected i need to remove them from the list again. Suggestions for this is appreciated or a code and i'll owe you one <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile -->
Website: <!-- m --><a class="postlink" href="http://www.PBAProductions.com">http://www.PBAProductions.com</a><!-- m -->
E-Mail: <!-- e --><a href="mailtoTongueatrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
[Image: 2hnx8av.jpg]
#2
Well, in order to have them removed from the list, they need to actually be able to disconnect properly, so let's focus on that first.

xolara Wrote:clientSocket.Disconnect ' This will simply Freeze the damn program, But it does disconnect the damn thing
You can try putting all of the sockets in a separate thread, so it will take a while but have no effect on the actual program. This may work, but probably not.

If that doesn't work, you can try out the BeginDisconnect() method, that may do something. (Documentation: <!-- m --><a class="postlink" href="http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.begindisconnect.aspx">http://msdn.microsoft.com/en-us/library ... nnect.aspx</a><!-- m -->)
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  multiple csv files add sql server tables via VB.NET secilsengul 1 10,013 04-16-2014, 10:27 AM
Last Post: brco900033
  Downloading from FTP server doesn't work brco900033 5 21,929 08-16-2013, 04:32 AM
Last Post: brco900033
  Very New to Programming Need advice . pwsincd 8 28,748 05-05-2013, 11:15 PM
Last Post: pwsincd
  How can I get the server status??? mnxford 5 23,860 03-27-2013, 10:53 AM
Last Post: mnxford
  Is this possible with SQL Server? Worf 2 12,382 02-25-2013, 03:04 AM
Last Post: Worf

Forum Jump:


Users browsing this thread: 1 Guest(s)