By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

Q:Socket class bind for listen question

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <bn*********@enews2.newsguy.com>, HABJAN ®iga wrote:
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
--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.