LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP communication

Hi,
we run a software on a target system in an industrial environment. To get an overview over the production we connected this target system to the customers network and send a protocoll of the production every minute. On the office computer of our customer a second application is running to receive the protocolls.
We send data over the TCPServer -Client function of CVI.

This is working in nearly ever case except two customers of us. There it is not working. The data are corrupted when they are received. We don't know why.

Does any one of you know what can happen to the data when they are transmitted ?

Thanks in advance
Oliver
0 Kudos
Message 1 of 7
(4,321 Views)
TCP is designed to be a reliable delivery mechanism. It keeps track of packets sent and the order in which they were sent. It also keeps track of incomplete or corrupted packets. TCP will request the sender to resend a packet that is in error and will reassemble the data stream in the order in which it was sent, even if it receives packets out of order.

I don't think that the problem lies on the network or in the TCP protocol. CVI uses the Winsock TCP/IP stack to communicate and that is a very stable and proven implementation of the TCP protocol. The CVI functions serve as a wrapper around the lower level socket commands. I have used the CVI mechanism in the past with no problems, it seems pretty stable and bug free to me too.

It sounds to me like something in either the server or client program is causing data corruption either before it is sent or after it is received. Do you have any way to log the data being sent? How do these two customer sites differ from the others?
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 7
(4,316 Views)
Hi,
just a few infos:
We conneceted 5 computers to a network-switch. The server of the customer is also connected to this switch. The customers office computer is connected to the server of the company.
If I connect my notebook to the switch the communication is working. The communication with the customers computer is not working.

Greetings
Oliver
0 Kudos
Message 3 of 7
(4,312 Views)
I would suggest starting with connecting just the two machines together that need to talk to each other. Verify that they are working and then add another machine to the network, do it again until you find the machine that is causing the problem.

It is possible that the port number you have chosen for your application conflicts with another application on the network. If this is the case, trying a different port number is likely to fix the problem. This is why I suggest always having a means to specify the TCP port you are going to use with your software. It saves having to recompile your program in situations where there is a conflict.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 4 of 7
(4,309 Views)
Hi,
the port number is a good tip. In my opinion this can be the problem.

but how can I find out which port is possible. Are there some standart ports which I can use ? Or does it not matter which port I use ? Are there some general rules in using ports ?
Can I find out which ports are used in the customers network ?


Regards
Oliver
0 Kudos
Message 5 of 7
(4,294 Views)
There are a number of ports that are assigned to common services. For instance SMTP servers use port 25, HTTP use port 80. There is a list of well-known ports that has a list of services and the ports that they use. This information (and almost everything regarding TCP/IP) is contained in a document called an RFC.

This page has a list of all well-known ports:

http://www.codecutters.org/resources/knownports.html

It also links to a lot of other good stuff. As a general guideline, your application should never use any port numbers between 0 and 1023 unless you are actually providing one of the services listed on that page. There are also a lot of "registered" ports in use, see this page for more info:

http://www.codecutters.org/resources/regports.html

So what port should you use? Well, that's hard to say. You can pretty much choose a port at random above 1023. However, it is advisable to stay away from any of the registered ports. There are a lot of them, but there are also a lot that have not been claimed. I recommend something in the 40000s simply because not many people use that range. The range from 49152 to 65000 is also defined as "private" so you may wish to use a port from that range.

Ideally, you want to be able to specify the port you use on both the server and the client. Making this something you can configure instead of hard-coding it will go a long way towards preventing conflicts.

One last thing you can do to determine what ports are in use on a network is to use a tool like Nmap to do a port scan. Nmap is available for download from http://www.insecure.org/nmap/ Nmap is a tool that is usually used for checking network security but can be useful for other things like finding out what ports are in use on a network.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 6 of 7
(4,283 Views)
Hi Martin,

I hope you are still there.
I tried several Ports, for example, 64001, but I had the same problem that the datas were corrupted.

Is it possible that the data stream I want to send is to big ? I try to send 7500 datas x sizeof(long). Is it better to decrease the size ? Does this matter ?

Greetings
Oliver
0 Kudos
Message 7 of 7
(4,123 Views)