Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- >UDP is much more fast, especially with short packets; Much more - how much? 200%? 50%? I need to know what will be the benefit to know is it usefull to spend time to get this benefit or not. --- Quote End --- A comparision between TCP and UDP speed performance must take into account how data is exchanged. Let's assume your client need to transfer 100 bytes of data at once and then wait for a 100 bytes answer from the server. UDP would send a single packet, 100bytes data payload + 42 bytes protocol overhead; then you'd have to wait the single packet answer from the server. TCP instead would initially send a packet with the 100bytes data payload + 54 bytes protocol, then it would wait for acknowledgement from the server; the ack frame could or could not contain the actual answer: depending from server speed and its tcp protocol implementation, the actual answer data could be send later with another packet. Eventually the client must send its acknowledgement for receiving the answer frame. So, in this simple case you would have 3 to 4 packets for a simple client- server transaction, with the associated delays due to protocol management and trasmission times on the physical layer medium. In a different situation, where the client is supposed to send a lot of data in streaming fashion, TCP could be more convenient, since the transport protocol allows continuos transfer of reliable data without introducing significative delays.