title: NetworkCommsDotNet , how can I reverse TCP client and server functions in this code?
body: <p><strong>EDIT</strong>
  With all great functionality that NetworkCommsDotNet offers, it looks like this library is not actively supported anymore. I am changing direction to accept Eser's response as answer. I tested the provided code and it worked. Thanks for your help.</p>
  
  <hr>
  
  <p>Below is my code of simple TCP client-server, based on NetworkCommsDotNet library. The client periodically sends changing positions of an "object" to the server, and the server displays them. This works fine, however, what I want to achieve is exactly the opposite: I want the client to only connect to the server, and once the server detects a connection, then it starts periodically sending some X and Y coordinates back to the client. I could not have this done with NetworkCommsDotNet, any help is appreciated.</p>
  
  <p><strong>Client:</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  using NetworkCommsDotNet;
  using NetworkCommsDotNet.Connections.TCP;
  
  namespace ObjectPositionClient
  {
    class Program
    {
      static void Main(string[] args)
      {
  
          try { 
              var conn = TCPConnection.GetConnection(new ConnectionInfo("127.0.0.1", 50747));
  
              System.Timers.Timer tmer;
              tmer = new System.Timers.Timer(3000);
              tmer.Elapsed += (sender, e) =&gt; TimerElapsed(sender, e, conn);
              tmer.Enabled = true;
  
              Console.WriteLine("Press any key to exit client.");
              Console.ReadKey(true);
              NetworkComms.Shutdown();
          }
          catch (Exception e)
          {
              Console.WriteLine(e.InnerException + "\n" + e.Message);
          }
  
      }
  
      static public void TimerElapsed(object sender, System.Timers.ElapsedEventArgs e, TCPConnection conn)
      {
          Random rnd = new Random();
          int X = rnd.Next(1, 101);
          int Y = rnd.Next(1, 51);
  
          conn.SendObject("Message", "X=" + X + "; Y=" + Y);
      }
    }
  }
  </code></pre>
  
  <p><strong>Server:</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  using NetworkCommsDotNet;
  using NetworkCommsDotNet.Connections;
  
  
  namespace ObjectPositionServer
  {
    class Program
    {
      static void Main(string[] args)
      {
  
          try
          {
              var con = Connection.StartListening(ConnectionType.TCP, new System.Net.IPEndPoint(System.Net.IPAddress.Any, 50747));
  
              NetworkComms.AppendGlobalIncomingPacketHandler&lt;string&gt;("Message", PrintIncomingMessage);
  
              Console.WriteLine("Server ready. Press any key to shutdown.");
              Console.ReadKey(true);
              NetworkComms.Shutdown();
  
          }
          catch (Exception e)
          {
              Console.WriteLine(e.InnerException + "\n" + e.Message);
          }
  
      }
  
  
      private static void PrintIncomingMessage(PacketHeader header, Connection 
       connection, string message)
      {
          Console.WriteLine(message + "\n");
  
      }
    }
  }
  </code></pre>