Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 my code:-


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");
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900