|
-
Nov 11th, 2011, 05:40 AM
#1
Reconnecting to a server using the same EndPoint
Well, I've been stuck for 2 days already.
Basically I'm working on a client/server application that should work in a 24/7 mode. Periodically a client part should connect to a server part using TCP/IP, receive some information and transmit its own one.
Then the connection is closed for some period of time and then the whloe process should be repeat.
I'm stuck with reconnection. I either get:
Once the socket had been disconnected, you can only reconnect again asynchronously, and only to a different EndPoint. BeginConnect must be called on a thread that won't exit until the operation has been completed.
or
Only one usage of each socket address (protocol/network address/port) is normally permitted
Basically I need to connect to a server using the same IPAddress/Port combination as before.
I tried Client.Close(), Client.Shutdown(SocketShutdown.Both) + Client.Disconnect(True). I disposed of the TCPClient instance and waited till GC collects it.
What else should I do? I know a whole lot of programs that can disconnect/reconnect to a server multiple times. How it's done?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|