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)
        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)
        Catch ex As Exception
            Console.WriteLine("Winsock error: " + ex.ToString)
        End Try
        tmrlisten.Enabled = True
    End Sub

Recommended Answers

All 2 Replies

You r tring to write a GUI programming but using Console output .

Please change the Console.**** to something else in GUI


Are you trying to setup a server socket on port 0 ?

Loren Soth

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.