LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create second port for client.c

I have a configuration of six testers and one master on 4 PCs. 1 PC is dedicated to the master( server) and the other testers are split 2 per PC. I would like to know how to modify client.c in the samples to add 2 different ports to read and write data to/from the server.

My file is attached. tcpclient2.c

The first port works fine but when I send data to the second port, the receive buffer is empty.
0 Kudos
Message 1 of 4
(3,733 Views)
Your server has two port? (10000 and 10001)
or you need connect two client to one server(one tcp port 10000)
Port number in ConnectToTCPServer(..) is nubmer
where you want connect(server)
Client port number is allocated automaticaly.

Translated from Czech language.
0 Kudos
Message 2 of 4
(3,733 Views)
Hi,

The server example that comes with CVI is built to only handle 1 client at a time. If you are to use this example, you will have to modify it to register the 2nd port (RegisterTCPCallback) and also modify it to allow multiple clients to access. I have attached an example of a multiclient server that may help you achieve this.

Jeremy L.
National Instruments

For the client side, all you should have to do is connect to the 2 servers by the correct port numbers. Hope this helps!
Jeremy L.
National Instruments
0 Kudos
Message 3 of 4
(3,733 Views)
Thanks Jeremy,

This looks good I will give it try. I had do it a different way, because it needed to work right away.
0 Kudos
Message 4 of 4
(3,733 Views)