01-09-2020 02:02 AM
Hi,
I have developed a code to send and receive message using TCP Protocol. I am able to send message from TCPServerduplex.vi and it gets displayed on TCPClientduplex.vi. But vice versa is not happening. Kindly help me resolve this issue. Thank you in advance. Attaching both the vi.
01-09-2020 03:19 AM
In the TCPClientduplex you try to read 50 characters. If you don't send 50 characters, that read will fail.
I'd set the reads to CRLF mode, and paste a \r\n after everything I write. Instant synchronization...
AFAIK, Usually you call the listener side the server, as it 'servers' the connection... This is not related to who instantiates the contact, or who starts reading or writing.
01-09-2020 03:20 AM
Also, you should close the Listener Id reference. You get problems if you don't: memory leaks, but also "connection also in use" errors.
01-09-2020 07:48 AM
Generally, you should not be constantly opening and closing your connections. You should connect and start talking until one of them closes the connection. I often use a State Machine to handle my TCP/IP connections. This way you can easily go back to setting up a connection when a connection is lost.