Q:Socket class bind for listen question

  • Thread starter Thread starter HABJAN ®iga
  • Start date Start date
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
 
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
 
Back
Top