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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Winsock busy even after prog is closed

Status
Not open for further replies.

Mengbillar

Programmer
Jan 13, 2003
32
0
0
DE
OK I have a problem. I was trying a few things with the winsock tool. now i have a two-form-progra, where each form simulates an own program. using different ports but the same IP, i could connect both using winsock, send some data, etc. This all worked fine. BUT after I closed the program, e.g. to change some code, and wanted to try again, it didnt work any longer. I ordered one of the forms to listen. ok. now i order the second one to connect, and at the winsock1.connect line, it stops with the error:
Run-time error '10048':
Address in use.
What address? How can I solve this problem OR does anyone have a link (or whatever) to some information about winsock run-time errors, since i couldnt find any such error described in MSDN. However, if I wait a bit, like 5 minutes or so (but definately no less than that) it will work again. I have a QuerryUnload event that closes the connection before either form is closed... what am i doing wrong???

Thanks for your reading this far :)
 
This is probably way off, but if they close the form with your Exit button, does that not count as part of your QueryClose statement? Put Me.Hide in the Exit button.

Sorry if it's useless.
 
my form does not have any exit buttons at the moment, i use the one in the title bar, which should take care of closing the app all by itsself normally
 
Im having the same problem with winsock. I run my program on two computers, they connect, I disconnect, and try to reconnect, but it doesnt work. Everytime i get the 'Address in use' error. Just to make sure it closed, I put this code in the queryunload event:

Winsock1.Close
Do
DoEvents
Loop Until Winsock1.State = sckClosed

Its not working, however. Anyone know whats going wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top