02-17-2009 10:42 AM
Hi everyone,
I am looking at the CVI help information for the functions ConnectToTCPServer and ConnectToTCPServerEx and I cannot find much difference except that the latter has a note to let the function select the default port. Is there any other significant difference between the two?
I am planning to use these functions to connect to devices that my company makes that are accessible via our network. These devices have Ethernet ports with third party modules that allows the devices to have an IP address. Essentially, our devices are servers, but do not use the CVI TCP functions on the server end. Will this cause me problems for connecting and retrieving data?
Thank you,
Judy
02-17-2009 05:25 PM - edited 02-17-2009 05:26 PM
Hi Judy.
The ability to specify the client (local) port appears to be the only difference.
According to this article:
Explicitly Specifying a Client Port
Unlike TCP servers, it is not necessary for TCP clients to explicitly specify or register a port for the connection. However, because of the presence of network firewalls and so on, you might want to specify the local host port the client program uses to establish a connection to the TCP server. To specify the client port, you must use the ConnectToTCPServerEx function, which includes the clientPort parameter. This parameter is different from the serverPort parameter, which you must specify correctly no matter which function you use. If you specify the client port explicitly, you must make sure that other TCP programs are not using that client port. National Instruments recommends that you not explicitly specify the client port unless it is necessary to use a specific client port. Use TCP_ANY_LOCAL_PORT if you do not need to specify the client port explicitly.
Regards,
Colin.
02-18-2009 07:34 AM
Hi Colin,
Thanks for the info and the link!
Judy