Winsock failed to connect to local ip address
Posted
by
JKS
on Stack Overflow
See other posts from Stack Overflow
or by JKS
Published on 2011-01-09T08:35:20Z
Indexed on
2011/01/09
8:53 UTC
Read the original article
Hit count: 291
I have used the following code in a form that acts like a server,
WskServer(0).Close
LocalIP = WskServer(0).LocalIP
WskServer(0).LocalPort = DEFAULT_TCP_PORT
WskServer(0).Protocol = sckTCPProtocol
txtStatus.Text = "Starting server"
Call WskServer(0).Bind(DEFAULT_TCP_PORT, LocalIP)
WskServer(0).Listen
when i execute above code,i received the following error
"Address is not available from the local machine" .
If i changed the line
Call WskServer(0).Bind(DEFAULT_TCP_PORT, LocalIP)
to
Call WskServer(0).Bind(DEFAULT_TCP_PORT, "127.0.0.1") this is working
What's wrong with the code?, can anybody give the fix
Update
I just removed the line Call WskServer(0).Bind(DEFAULT_TCP_PORT, LocalIP) now server working properly. this way is correct or not
© Stack Overflow or respective owner