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
90
votes
8 answers

JavaScript WebSockets with UDP?

I'm writing a JavaScript Application that has to receive a huge amount of data from other users. It is not important if some of this data gets lost. Is there some way of using JavaScript WebSockets with UDP instead of TCP?
user142019
88
votes
17 answers

What are examples of TCP and UDP in real life?

I know the difference between the two on a technical level. But in real life, can anyone provide examples (the more the better) of applications (uses) of TCP and UDP to demonstrate the difference?
Leon
  • 8,151
  • 11
  • 45
  • 51
88
votes
4 answers

What does it mean to bind a multicast (UDP) socket?

I am using multicast UDP between hosts that have multiple network interfaces. I am using boost::asio, and am confused by the 2 operations receivers have to make: bind, then join-group. Why do you need to specify the local address of an interface,…
haelix
  • 4,245
  • 4
  • 34
  • 56
79
votes
4 answers

Difference between UNIX domain STREAM and DATAGRAM sockets?

This question is NOT for the difference between STREAM type and DATAGRAM type INTERNET sockets. I know that STREAM sockets use TCP, Datagram sockets use UDP and all the TCP,UDP stuff, packets arriving in order, ACK, NACK etc. I understand the…
Manik Sidana
  • 2,005
  • 2
  • 18
  • 29
79
votes
5 answers

WebSockets, UDP, and benchmarks

HTML5 websockets currently use a form of TCP communication. However, for real-time games, TCP just won't cut it (and is great reason to use some other platform, like native). As I probably need UDP to continue a project, I'd like to know if the…
bobbybee
  • 1,758
  • 1
  • 16
  • 27
76
votes
5 answers

How do I choose a multicast address for my application's use?

How should I choose an IPv4 multicast address for my application's use? I may need more than one (a whole range perhaps ultimately) but just want to avoid conflicts with other applications. Packets will be entirely contained within an…
MarkR
  • 62,604
  • 14
  • 116
  • 151
69
votes
6 answers

C# little endian or big endian?

In the documentation of hardware that allows us to control it via UDP/IP, I found the following fragment: In this communication protocol, DWORD is a 4 bytes data, WORD is a 2 bytes data, BYTE is a single byte data. The storage format is little…
TimothyP
  • 21,178
  • 26
  • 94
  • 142
68
votes
2 answers

TCP vs UDP - What is a TCP connection?

What exactly is a TCP connection? I understand there isn't a physical connection from the client to server. Is this connection just the client's socket being linked with the new socket created by the server after the three-way-handshake? Thereafter…
Cheese
  • 1,429
  • 3
  • 16
  • 17
62
votes
4 answers

How to monitor Linux UDP buffer available space?

I have a java app on linux which opens UDP socket and waits for messages. After couple of hours under heavy load, there is a packet loss, i.e. the packets are received by kernel but not by my app (we see the lost packets in sniffer, we see UDP…
Yoni Roit
  • 28,280
  • 7
  • 36
  • 32
61
votes
3 answers

Does TCP send a SYN/ACK on every packet or only on the first connection?

I have a TCP server that listens for an incoming client, then sends it one packet of data every second. I was wondering, does the SYN/ACK packet only get sent on initial connection, so it looks like this:
Daniel T.
  • 37,212
  • 36
  • 139
  • 206
60
votes
6 answers

How to find the largest UDP packet I can send without fragmenting?

I need to know what the largest UDP packet I can send to another computer is without fragmentation. This size is commonly known as the MTU (Maximum Transmission Unit). Supposedly, between 2 computers, will be many routers and modems that may have…
Unknown
  • 45,913
  • 27
  • 138
  • 182
60
votes
3 answers

What is "backlog" in TCP connections?

Below, you see a python program that acts as a server listening for connection requests to port 9999: # server.py import socket import time # create a socket object serversocket = socket.socket( …
user3739941
59
votes
2 answers

Simple UDP example to send and receive data from same socket

For some reason I am having a hard time sending and receiving data from the same socket. Anyways here is my client code: var client = new UdpClient(); IPEndPoint ep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 11000); // endpoint where server is…
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
55
votes
5 answers

Blocking sockets: when, exactly, does "send()" return?

When, exactly, does the BSD socket send() function return to the caller? In non-blocking mode, it should return immediately, correct? As for blocking mode, the man page says: When the message does not fit into the send buffer of the socket,…
David Citron
  • 43,219
  • 21
  • 62
  • 72
55
votes
3 answers

UDP multicast group on Windows Phone 8

OK this is one I've been trying to figure out for a few days now. We have an application on Windows Phone 7 where phones join a multicast group and then send and receive messages to the group to talk to each other. Note - this is phone to phone…
Adam Stewart
  • 1,983
  • 1
  • 18
  • 25