Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you can try something like this.....</p> <p>server Side Code</p> <pre><code>namespace Consoleserver { class Program { static void Main(string[] args) { IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000); Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); try { listener.Bind(localEndPoint); listener.Listen(10); while (true) { Console.WriteLine("Waiting for a connection..."); Socket handler = listener.Accept(); Console.WriteLine("connected"); } } catch { Console.WriteLine("error"); } } } </code></pre> <p>Client side code :</p> <pre><code> namespace consoleclient { class Program { static void Main(string[] args) { try { IPHostEntry ipHostInfo = Dns.Resolve("59.178.131.180"); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint remoteEP = new IPEndPoint(ipAddress, 11000); Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { sender.Connect(remoteEP); Console.WriteLine("Socket connected &lt;strong class="highlight"&gt;to&lt;/strong&gt; {0}", sender.RemoteEndPoint.ToString()); } catch (ArgumentNullException ane) { Console.WriteLine("ArgumentNullException : {0}", ane.ToString()); Console.Read(); } catch (SocketException se) { Console.WriteLine("SocketException : {0}", se.ToString()); Console.Read(); } catch (Exception e) { Console.WriteLine("Unexpected exception : {0}", e.ToString()); Console.Read(); } } catch { Console.WriteLine("could not &lt;strong class="highlight"&gt;connect&lt;/strong&gt; A"); } } } } </code></pre> <p>I hope it will helps you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload