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

Asyncronous socket does not accept more then one connection

P: n/a
Code:
\\\\\\\\
Private Sub ConnectionsListener()
_acceptCallBack = New AsyncCallback(AddressOf acceptHandler)
'Dim listenSocket As Socket
Try
_listenSocket = New Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)
_listenSocket.Bind(New System.Net.IPEndPoint(IPAddress.Any,
Me._ApplicationPort))
_listenSocket.Listen(-1)
_listenSocket.BeginAccept(_acceptCallBack, _listenSocket)
Catch ex As Exception
msgbox(ex.tostring)
End Try
End Sub
////////
I run this as separate thread, but it only accepts first connection.

what is wrong?

tnx

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:jo******@mail.bg:
_listenSocket.BeginAccept(_acceptCallBack, _listenSocket)

I run this as separate thread, but it only accepts first connection.

what is wrong?


You need to accept the connection on another socket handle. Use
_listenSocket to listen, then an array of connectionSockets to handle
the connection.

--

-shane

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.