Q:Socket class bind for listen question

H

HABJAN ®iga

Hello,

how can i bind a socket for listen on some port, and all addresses :

In the sample i bind myself to localhost(127.0.0.1) on port 5500. It works
fine when connecting to localhost, but if i connect from another computer,
or i connect by computer name, the accept callback never happens.


Private sckL As Socket
<sub>
Dim lipa As IPHostEntry = Dns.Resolve("localhost")
Dim lep As New IPEndPoint(lipa.AddressList(0), 5500)
Me.sckL = New Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.IP)
Me.sckL.Bind(lep)
Me.sckL.Listen(10)
... begin accept ....
</sub>


I want to setup my socket like VB6 WinSock.ocx, with no address bind... just
port listen...

best regards,
habix
 
T

Tom Shelton

Hello,

how can i bind a socket for listen on some port, and all addresses :

In the sample i bind myself to localhost(127.0.0.1) on port 5500. It works
fine when connecting to localhost, but if i connect from another computer,
or i connect by computer name, the accept callback never happens.


Private sckL As Socket
<sub>
Dim lipa As IPHostEntry = Dns.Resolve("localhost")

Change this to Dns.Resolve(Dns.GetHostName())

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top