Cocket Socket Connect App for Hanging

My application freezes when connecting through System.Net.Sockets;

m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_Socket.Connect(Host, Port); 

This is freezing because either the host is not accepting the connection or the port is not opening.

How can i fix this?

thanks

+4
source share
1 answer

Can you use BeginConnect and try to establish the connection asynchronously?

+2
source

Source: https://habr.com/ru/post/1347004/


All Articles