G
Guest
Hi, i have a socket that i use to listen for a connection. there can be any
number of connections. when testing my socket, it sees the first connection,
then no others. i call the BeginAccept() method again, but it doesnt see any
other connections. heres the code...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim ep As New IPEndPoint(ipHome, PORT)
Try
socListen.Bind(ep)
socListen.Listen(50)
socListen.BeginAccept(AddressOf UserLogingIn, Nothing)
Catch ex As Exception
Call WriteError("Button1_Click", ex)
End Try
End Sub
Private Sub UserLogingIn(ByVal ar As IAsyncResult)
Try
Dim soc As New Connection
soc.soc = socListen.EndAccept(ar)
ReDim soc.buffer(4095)
socListen.BeginAccept(AddressOf UserLogingIn, Nothing)
soc.soc.BeginReceive(soc.buffer, 0, soc.buffer.Length,
SocketFlags.None, AddressOf UserSentSignOnInfo, soc)
lstConnected.Add(soc)
Catch ex As Exception
Call WriteError("UserLogingIn", ex)
End Try
End Sub
Connection is a structure of a byte array, socket, and name. all variables
have values, etc. VS2005. thanks
number of connections. when testing my socket, it sees the first connection,
then no others. i call the BeginAccept() method again, but it doesnt see any
other connections. heres the code...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim ep As New IPEndPoint(ipHome, PORT)
Try
socListen.Bind(ep)
socListen.Listen(50)
socListen.BeginAccept(AddressOf UserLogingIn, Nothing)
Catch ex As Exception
Call WriteError("Button1_Click", ex)
End Try
End Sub
Private Sub UserLogingIn(ByVal ar As IAsyncResult)
Try
Dim soc As New Connection
soc.soc = socListen.EndAccept(ar)
ReDim soc.buffer(4095)
socListen.BeginAccept(AddressOf UserLogingIn, Nothing)
soc.soc.BeginReceive(soc.buffer, 0, soc.buffer.Length,
SocketFlags.None, AddressOf UserSentSignOnInfo, soc)
lstConnected.Add(soc)
Catch ex As Exception
Call WriteError("UserLogingIn", ex)
End Try
End Sub
Connection is a structure of a byte array, socket, and name. all variables
have values, etc. VS2005. thanks