Lapsnaper TCP connection specification

2019-08-25 21:20发布

问题:

I am using Lapsnapper (a transponder timing system) running on Android.

Lapsnapper enables a TCP/IP server with which a connection can be made, to build a custom interface and get some other relevant data RE: the transponders etc from the system.

I do not understand the Lapsnapper tcp server specification.

I have done some tcp stuff before, but I am mostly a higher level programmer and to be honest I am a bit out of my depth with this raw TCP stuff.

The spec reads:

What I don't understand is how to "send" the tcp data? I don't understand how 0x70, 0x17 equates to (6000) and 2 bytes... The same goes for 0x13, 0x00, 0x00, 0x00 = 19 which the spec says should be 4 bytes, but a string of "19" is 2 bytes?

I am trying to understand what I am reading. Any help would be appreciated as I need to do quite a bit of comms to this server, and I want to understand what I am doing...

I have asked for help from lapsnapper support, but in the mean time I would like to learn something new as per the above.

What do I actually "send" on the TCP connection?

The spec says that I should expect a message back, but with my current implementation, a connection seems to be established, but I never receive anything back.

Response Message to expect:

My code: (P.S This code block works if I do a simple connection to a SMTP server and I can do a basic connection with reply from said smtp server. I however never receive a reply when I try to talk to the Lapsnapper TCP server using the code below)

                string lapSnapperIP = "10.0.0.131";
                int lapsnapperPort = 9001;

                string lapSnapperMessageID;
                string lapsnapperLengthOfMessage;
                string lapsnapperProductID;
                string lapsnapperServerVersion;
                string lapsnapperPasswordLength;
                string lapsnapperPassword;

                lapSnapperMessageID = "6000";
                lapsnapperLengthOfMessage = "19"; //to implement
                lapsnapperProductID = "50";
                lapsnapperServerVersion = "100000";
                lapsnapperPasswordLength = "4";
                lapsnapperPassword = "1234";

                string lapSnapperDataSend;

                lapSnapperDataSend = lapSnapperMessageID + lapsnapperLengthOfMessage + lapsnapperProductID + lapsnapperServerVersion + lapsnapperPasswordLength + lapsnapperPassword;

                s.Connect(lapSnapperIP, lapsnapperPort);

                byte[] sendMessage = Encoding.UTF8.GetBytes(lapSnapperDataSend);

                byte[] receiveBytes = new byte[256];

                int i = 0;
                string receivedMessage = "";

                //send data
                i = s.Send(sendMessage);

                //receive data
                i = s.Receive(receiveBytes);         // (no reply here...)

                receivedMessage = Encoding.UTF8.GetString(receiveBytes);

Thanks