Questions tagged [udp]

User Datagram Protocol is one of the messaging protocols of the IP protocol stack. With UDP, computer applications can send messages to other hosts on an Internet Protocol (IP) network without requiring prior communications to set up special transmission channels or data paths.

UDP uses a simple transmission model without implicit handshaking dialogues for providing reliability, ordering, or data integrity. Thus, UDP provides an unreliable service and datagrams may arrive out of order, appear duplicated, or go missing without notice.

UDP assumes that error checking and correction is either not necessary or performed in the application or at the hardware level (layer 1 and 2), avoiding the overhead of such processing at the network interface level.

Time-sensitive applications often use UDP because dropping packets is preferable to waiting for delayed packets, which may not be an option in a real-time system.

There is more information at the Wikipedia article on UDP.

10654 questions
52
votes
10 answers

Can you bind() and connect() both ends of a UDP connection

I'm writing a point-to-point message queue system, and it has to be able to operate over UDP. I could arbitrarily pick one side or the other to be the "server" but it doesn't seem quite right since both ends are sending and receiving the same type…
gct
  • 14,100
  • 15
  • 68
  • 107
52
votes
5 answers

Why is SNMP usually run over UDP and not TCP/IP?

This morning, there were big problems at work because an SNMP trap didn't "go through" because SNMP is run over UDP. I remember from the networking class in college that UDP isn't guaranteed delivery like TCP/IP. And Wikipedia says that SNMP can be…
EC0
  • 663
  • 1
  • 7
  • 10
50
votes
2 answers

UDP vs IP- difference?

I understand that UDP resides on the transport layer and IP on the internet layer. I also get that they're both connectionless and unreliable. Then what is the point of UDP when we already have IP? The distinction is not very clear. Any help on this…
OckhamsRazor
  • 4,824
  • 13
  • 51
  • 88
47
votes
6 answers

TCP stream vs UDP message

TCP is stream oriented meaning data is transferred as a continues stream of bytes. But what confuses me is that TCP creates segments and passes this down to IP. IP creates packets encapsulates segments and transfers them. So where exactly the…
Kuzey
  • 839
  • 2
  • 7
  • 9
46
votes
3 answers

Can I use broadcast or multicast for TCP?

For Internet Protocol (IP) I can use multicast: in IPv4: Internet Group Management Protocol (IGMP) in IPv6: Multicast Listener Discovery Also, in example, for UDP I can use: broadcast - to send packet to range of addresses multicast - to send…
Alex
  • 12,578
  • 15
  • 99
  • 195
42
votes
2 answers

UDP Socket Set Timeout

I am trying to set a 100ms timeout on a UDP Socket. I am using C. I have posted relavent pieces of my code below. I am not sure why this is not timing out, but just hangs when it doesn't receive a segment. Does this only work on sockets that are…
rharrison33
  • 1,252
  • 4
  • 18
  • 34
41
votes
8 answers

Sending and receiving UDP packets between two programs on the same computer

Is it possible to get two separate programs to communicate on the same computer (one-way only) over UDP through localhost/127... by sharing the same port #? We're working on a student project in which we need to send UDP packets containing some…
Cecil Has a Name
  • 4,962
  • 1
  • 29
  • 31
41
votes
2 answers

What's the purpose of using sendto()/recvfrom() instead of connect()/send()/recv() with UDP sockets?

I can grasp the concept of TCP vs UDP, but still I don't know why are there 2 ways of sending UDP packets, and with that I still don't understand if this is absolutely necessary to bind() and accept()...
jokoon
  • 6,207
  • 11
  • 48
  • 85
41
votes
4 answers

Sending UDP broadcast, receiving multiple messages

I've got 2 programs, 1 for sending an UDP broadcast message and 1 that is listening for this broadcast. My problem is that sometimes when I send a broadcast, the receiver receives 2 messages. Why? Receiver code: public class Receiver { private…
Paw Baltzersen
  • 2,662
  • 3
  • 24
  • 33
40
votes
7 answers

What is the optimal size of a UDP packet for maximum throughput?

I need to send packets from one host to another over a potentially lossy network. In order to minimize packet latency, I'm not considering TCP/IP. But, I wish to maximize the throughput uisng UDP. What should be the optimal size of UDP packet to…
sep
  • 3,409
  • 4
  • 29
  • 32
40
votes
2 answers

Is SMTP based on TCP or UDP?

Is SMTP based on TCP or UDP ? I really can't confirm it . In my opinion, SMTP should be based on UDP, but someone told me that is must be TCP.
Jerry Cai
  • 571
  • 2
  • 8
  • 18
37
votes
10 answers

Why Does RTP use UDP instead of TCP?

I wanted to know why UDP is used in RTP rather than TCP ?. Major VoIP Tools used only UDP as i hacked some of the VoIP OSS.
Priyanka Mishra
  • 10,400
  • 18
  • 62
  • 75
37
votes
5 answers

How to do Network discovery using UDP broadcast

I want to to do network discovery using UDP Broadcast in C#. I don't know how to do this. Can you give me advice on how to do it? I want to do like this tutorial.
NTK88
  • 573
  • 1
  • 6
  • 12
37
votes
2 answers

Best C++ RTP/RTSP library

I'm looking for a RTP/RTSP library in C++. I found pjsip but it is more C-style. I'm looking for more OO library.
cubesoft
  • 3,448
  • 7
  • 49
  • 91
37
votes
2 answers

UDP hole punching not going through on 3G

I'm trying to implement in a software a hole punching feature. The thing is, I'm implementing this with an already made TCP Server to communicate with Users. Here's what I have so far : "A" sends a message to an UDP Server "US" (on port 9333) "US"…
TheSquad
  • 7,385
  • 8
  • 40
  • 79