how to correctly close a serversocket

vangogh

Active Member
Licensed User
Longtime User
when my prog ends, I need to close the sockets

I open this way:
Dim tcpServer As ServerSocket
Dim tcpClient As Socket

tcpServer.Initialize(1,"tcpServer") ' used only to get my ip address
tcpClient.Initialize("tcpClient")

also without connecting (tcpclient.connect), if I try to close the app:
tcpClient.close
tcpServer.close

when I relaunch the app it says "address already in use"
(the same problem happens using your tutorial prog "network")
(if i relaunch again... it works! one time OK one time KO)

it seems to be a problem related to the serversocket, and not to the socket (I deleted all the occurrencies of tcpclient and I got the same issue), but it happens ALSO if I don't initialize tcpServer

so what?
 
Last edited:

vangogh

Active Member
Licensed User
Longtime User
it is tcpServer.Initialize

Actually I don't need to listen for incoming connecton... I use the serversocket only to get my IP address
 
Upvote 0
Top