Click here to Skip to main content
15,746,006 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Tcp Listener in winform C# crashed pls fix my code

What I have tried:

TcpListener serverSocket = new TcpListener(8888);
           TcpClient clientSocket = default(TcpClient);
           clientSocket = serverSocket.AcceptTcpClient();
           textBox1.Text = ("\n>> Accept connection from client\r\n");
           while (true) ;
Updated 4-Jul-19 2:54am
F-ES Sitecore 4-Jul-19 9:28am    
Google for examples of using sockets. Your "while" loop is simply going to loop forever making the app unresponsive.

1 solution

while (true) ;

That statement never ends.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900