LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using UDP to communicate with a TCP server

Hi,

Can I use UDP to transmit message to a TCP server?  if it can , what way can be approach ?


David
0 Kudos
Message 1 of 4
(3,532 Views)

The quick answer is no, UDP and TCP are two different transport protocols that both run on top of the IP (Internet Protocol) that are not compatible with one another.

That is because these protocols are intended to serve different purposes and they have different framing formats.

IP defines the framing for an Internet message that includes a source address, destination address and a CRC checksum appended to the payload data.

UDP (User Datagram Protocol) is intended for short messages that do not require reassembly, sequencing or error correction. Basically, the model for UDP is that an application sits on the network listening for UDP datagrams and handles them as they arrive from other applications which could be running on another machine or even on the same machine. That application that receives the datagrams does something with them, perhaps logging them, perhaps sending a UDP datagram in reply. UDP is a best-effort delivery system, it essentially does its best to put data on the network but once it does, it is done. UDP is essentially a connectionless protocol.

TCP (Transmission Control Protocol) is intended for reliable, streaming data. It handles such things as creating a persistent two-way data connection, fragmentation and reassembly of large datagrams, presentation of received data in the order in which it was transmitted, and retransmission of frames containing errors. This protocol is intended for more demanding applications that require data integrity such as a file transfer or something similar. There is a lot more overhead in this protocol to handle the reliability features and data transmission speed control.

I hope that helps you understand what these protocols are and why they do not work together 

I could probably suggest a potential structure for your application if I can get a little detail about what you are looking to do.

 

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 4
(3,524 Views)
Thanks. In fact, my project use a HMI application to manage hundred of embedded devices, each device is placed a TCP server, I need to use network communication to understand which device is working, but due to there are so many devices to poll, the time consuming is too long, could you have any idea to improve the status?


David
0 Kudos
Message 3 of 4
(3,509 Views)
You could try polling all the devices in parallel using multiple threads - one thread for each device. This might speed up your task.
0 Kudos
Message 4 of 4
(3,485 Views)