using System;
using System.Linq;
using System.Net.Sockets;
// Reference from http://csharp.net-informations.com/communications/csharp-socket-programming.htm
// Client
namespace test2
{
    class Program
    {    	
        static void Main(string[] args)
        {
       		TcpClient clientSocket = new TcpClient();
            Console.WriteLine(">> Client Started");
            Console.WriteLine(">> What is server ipaddress? (10.0.0.1)");       
            // clientSocket.Connect("127.0.0.1", 8888);
            // clientSocket.Connect("localhost", 8888);
            // clientSocket.Connect("192.168.43.235", 8888);
            String serverip = Console.ReadLine();       	
            clientSocket.Connect(serverip, 8888);                       
            NetworkStream serverStream = clientSocket.GetStream();
            byte[] outStream = System.Text.Encoding.ASCII.GetBytes("Hello World!" + "$");
            serverStream.Write(outStream, 0, outStream.Length);
            serverStream.Flush();
			Console.WriteLine(">> Connect and send message : ok");            
            Console.WriteLine(">> Press any key to exit.");
            Console.ReadLine();
        }
         
    }
}