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.

2 or more client on single TCP port


rawon87 Dec 3, 2019 08:52 AM

hi, 

with CR1000x, i'm trying to stream my measurement result via tcp to 2 different tcp client.

my test script is as below

const CR = CHR(13)

const LF = CHR(10)

public tcp_stream (3) as long

beginprog

tcpopen("",4001,100,100,tcp_stream,3)

Scan (10,sec,0,0)

serialout(tcp_stream,"testing stream out"&CR&LF,"",0,100)

nextscan

endprog

the server stream out fine with one listening client

but when i connect the second client, the array 2nd field of tcp_stream only display value momentarily, the client connect then drop the connection as if it timeout

what do i miss out?

thank you beforehand


JDavis Dec 3, 2019 07:50 PM

You should do a SerialOut for each nonzero socket.

 

  For i = 1 To 3
      If tcp_stream(i) <> 0 Then
        SerialOut(tcp_stream(i),"testing stream out"&CR&LF,"",0,100)
      EndIf
    Next

 


rawon87 Dec 4, 2019 09:44 AM

Thanks Jdavis, as always, work like a charm

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