Rahul Hendawe

Rahul Hendawe

  • NA
  • 8
  • 1.9k

Acknowledging concox GT06N gps device after receiving login

Aug 19 2015 10:09 AM

I am receiving login packet from my concox GT06N gps device.Also i have read it.But when i am trying to send response packet(acknowledgement) to device it seems like the response packet is not getting delivered. Because after sending acknowledgement i am not receiving location packet from device. Below is the code i am using:-

TcpClient cli = new TcpClient(); 
IPEndPoint deviceIPE = new IPEndPoint(IPAddress.Parse(System.Configuration.ConfigurationManager.AppSettings["CID"].ToString()), Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["CPORT"]));
cli.Connect(deviceIPE);                         
logsys.Enqueue("TCP Client created");                         
using (NetworkStream clientstream = cli.GetStream()) 
{ 
byte[] data = (byte[])sdata1.Dequeue(); 
string cip = suser1.Dequeue().ToString(); 
string[] acip = new string[2]; if (cip != "") 
{                                 
acip = cip.Split(':'); 
} 
TechnoComPacket packet = new TechnoComPacket(data); 
string rdata = packet.StringToByteArray(data);                              
logsys.Enqueue("Response Packet to be Send Is :" + rdata); 
byte[] toSend = Encoding.ASCII.GetBytes(rdata); 
ASCIIEncoding encoder = new ASCIIEncoding(); 
byte[] buffer = encoder.GetBytes(rdata);                             
clientstream.Write(buffer, 0, buffer.Length);                             
logsys.Enqueue("Response Packet Sent successfully"); }

 

Please help me.I am stuck.

Thanks in advance