Pandiyan T

Pandiyan T

  • NA
  • 23
  • 1.6k

Gps Tracking, Server

Jun 6 2015 9:32 AM
hi 
 i'm pandiyan, now i have working with gps tracking system. i have server program but it's not listen the client (gps device) .
 

try

{

IPAddress ipAd = IPAddress.Parse("192.168.1.198");

TcpListener myList = new TcpListener(ipAd, 4321);

myList.Start();

Console.WriteLine("\nThe local End point is :" + myList.LocalEndpoint);

Socket s;

while (true)

{

string path=Application.StartupPath;

Console.WriteLine(" connection started.....");

s= myList.AcceptSocket();

Console.WriteLine("Connection accepted from " + s.RemoteEndPoint);

byte[] b = new byte[100];

int k = s.Receive(b);

Console.WriteLine("\nRecieved...");

for (int i = 0; i < k; i++)

Console.Write(Convert.ToChar(b[i]));

ASCIIEncoding asen = new ASCIIEncoding();

string a = Console.ReadLine();

s.Send(asen.GetBytes(a));

Console.WriteLine("\nSent Acknowledgement");

}

/* clean up */

s.Close();

myList.Stop();

Console.Read();

}

catch (Exception e)

{

Console.WriteLine("Error..... " + e.StackTrace);

Console.Read();

}

 
  thank you.