Good call I didn't realize the pause button thing. I found the app freezes long before that. On starting the server its stuck in loop not sure why? Cant it listen without freezing the form?
Code:Sub ServerStart() ' Data buffer for incoming data. Dim bytes() As Byte = New [Byte](1023) {} ' Establish the local endpoint for the socket. Dim ipHostInfo As IPHostEntry = Dns.Resolve(Dns.GetHostName()) Dim ipAddress As IPAddress = GetLocalIP() Dim localEndPoint As New IPEndPoint(ipAddress, 9001) ' Create a TCP/IP socket. Dim listener As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) ' Bind the socket to the local endpoint and listen for incoming connections. listener.Bind(localEndPoint) listener.Listen(100) TextBox1.Text = "Listening" & Environment.NewLine While True ' Set the event to nonsignaled state. allDone.Reset() ' Start an asynchronous socket to listen for connections. Console.WriteLine("Waiting for a connection...") listener.BeginAccept(New AsyncCallback(AddressOf AcceptCallback), listener) ' Wait until a connection is made and processed before continuing. ''Here is where it waits for a connection but why cant I even move my form allDone.WaitOne() End While End Sub




Reply With Quote
