![](http://www.cee.hw.ac.uk/~ceesm6/Pics/StevesSig.gif)
Winsock returns WSAEADDRINUSE
Yet another of my problems...
I''m writing a telnet client, and it works fine except occasionally connect() returns WSAEADDRINUSE. Anyone know what could cause this problem? I make sure i closesocket() on my socket before i shut down my app (due to user exiting or error), and shutdown() doesn''t help either. Windows telnet client still works fine though. My app is the only program running at the time (i mean windows telnet isn''t running).
If i leave it alone for 2 - 5 mins, then it works again.
I assume i''m not shutting down properly, so windows thinks the socket is still being used, but i''m 110% sure i shut the close the properly.
Any ideas?
![](http://www.cee.hw.ac.uk/~ceesm6/Pics/StevesSig.gif)
Member of the Unban Mindwipe Society (UMWS)
I''m a bit rusty on the telnet spec, but the client connection should be able to come from any port, so you shouldn''t be binding the client to port 23, but to port 0 for any available port. No?
I'm not sure that'll work. Surely the server will havwe to listen on 65000 ports then?
Edit: I've got my own telnet server program running too....
Edit 2: Its on another machine tho
![](http://www.cee.hw.ac.uk/~ceesm6/Pics/StevesSig.gif)
[edited by - Evil Bill on January 8, 2003 4:48:53 PM]
[edited by - Evil Bill on January 8, 2003 4:49:07 PM]
Edit: I've got my own telnet server program running too....
Edit 2: Its on another machine tho
![](http://www.cee.hw.ac.uk/~ceesm6/Pics/StevesSig.gif)
[edited by - Evil Bill on January 8, 2003 4:48:53 PM]
[edited by - Evil Bill on January 8, 2003 4:49:07 PM]
Member of the Unban Mindwipe Society (UMWS)
what he is saying is that the client socket doesnt need to be bound to port 23.....you need to connect to port 23 on the server....but the client socket doesnt need to be operating on port 23 of the client machine. It can be operating on any port of the client machine as long as it connects to port 23 of the server.
"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T
"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T
*ahem*
You know how i said i was 110% sure i was closing the socket? Well, lets call that 99% sure then :o
I cant believe i wrote: if(m_sock != INVALIDSOCKET) return;
Cheers for the replies
You know how i said i was 110% sure i was closing the socket? Well, lets call that 99% sure then :o
I cant believe i wrote: if(m_sock != INVALIDSOCKET) return;
Cheers for the replies
![](http://www.cee.hw.ac.uk/~ceesm6/Pics/StevesSig.gif)
Member of the Unban Mindwipe Society (UMWS)
Glad to hear you got it working, but NCSU is right. I meant that the client should be able to bind to any local port. You don''t need to bind that socket to port 23, bind it to 0 to indicate any available port.
The only place you need to specify 23 as the port number is in your call to connect().
The only place you need to specify 23 as the port number is in your call to connect().
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement