Ok, i've been tyring to get this to work for days, and I got it down to this, but it still all doesnt work. Any advice as to what I may be doing wrong would be greatly appreciated.
Function Listen(ByVal backlog As Integer)
lsocket.Listen(backlog)
If Not lsocket.Connected Then
Console.WriteLine("Winsock error: " + Convert.ToString(System.Runtime.InteropServices.Marshal.GetLastWin32Error()))
End If
End Function
Public Sub tmrlisten_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrlisten.Tick
txtchatwindow.Text = txtchatwindow.Text + vbNewLine + "Listening..."
If lsocket.Connected Then
tmrlisten.Enabled = False
End If
End Sub
Public Sub btnListen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListen.Click
Dim endpoint As New IPEndPoint(IPAddress.Any, 0)
Try
lsocket.Bind(endpoint)
Catch ex As Exception
Console.WriteLine("Winsock error: " + ex.ToString)
End Try
Listen(10)
tmrlisten.Enabled = True
End Sub