Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

How to write a code for CR300 to listen for a TCP feed that comes randomly?


Kong Aug 28, 2020 11:18 AM

HI guys,

I have the CR310 that I plan to write a code so that it will always listen to a feed of text (sample below)

-The feed will comes randomly within 15-20 minutes time frame. 

-Currently I am able to get the feed from the sensor via TCP but not all sentences were read, it will only read at the 0th,5th,10th ,...  second which correspondingly to the scan interval.

-Not sure if anyone can assist to correct me / let me know where I can study further?

Here are the codes I am using.

Public IncomingSensorString(15) As String * 150

SensorSocket = TCPOpen("192.168.0.96",13001,1024,1500)

a = 1
Do
   SerialInRecord (SensorSocket ,IncomingSensorString(a),&h24,0,&h2a,NBytesReturned,11)
a=a+1
Loop Until NBytesReturned = 0

and here are the sample data that will be transmit one at a time throught the feed.


$PNORI,3,WAV7377,3,2,0.41,1.00,0*24
$PNORS,112919,175030,00,30,14.8,1545.0,99.2,4.0,-9.1,1.251,29.73,0,0*41
$PNORC,112919,175030,1,-0.00,0.04,-0.03,0.04,353.5,C,179,176,184,,,*02
$PNORC,112919,175030,2,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,3,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,4,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,5,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,6,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,7,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,8,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,9,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORC,112919,175030,10,-0.14,0.08,-0.04,0.16,299.1,C,182,180,164,,,*0C
$PNORW,112919,172131,3,4,0.01,0.00,0.01,0.01,4.40,-9.00,5.73,-9.00,-9.00,-9.00,-9.00,1.25,0,114,1.19,168.47,0010*59

Appreciated your kind advise on this :)

Many thanks.

Log in or register to post/reply in the forum.