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
29
votes
7 answers

Best practices for encrypting continuous/small UDP data

I am having an application where I have to send several small data per second through the network using UDP. The application needs to send the data in real-time (no waiting). I want to encrypt these data and ensure that what I am doing is as secure…
temp
  • 485
  • 2
  • 5
  • 7
29
votes
7 answers

'inet_pton': identifier not found

I'm trying to include the following code in my program but the error ('inet_pton': identifier not found) will appeared. // IPv4: struct sockaddr_in ip4addr; int s; ip4addr.sin_family = AF_INET; ip4addr.sin_port = htons(3490); inet_pton(AF_INET,…
abdo.eng 2006210
  • 507
  • 2
  • 6
  • 12
29
votes
5 answers

with SIP, when to use TCP not UDP?

I know pretty the differences between UDP and TCP in general (eg. http://www.onsip.com/about-voip/sip/udp-versus-tcp-for-voip) Question is, in what circumstances would using TCP as the transport have advantages specifically under SIP VOiP…
Marcos
  • 4,796
  • 5
  • 40
  • 64
28
votes
3 answers

Why does UDP have a length field in the header and TCP does not?

Why does UDP have a length field in the header and TCP does not? I am guessing that the length of the segment in TCP is inferred from the IP header but one should be able to do the same for a UDP datagram
IP Help
28
votes
1 answer

Specifying UDP receive buffer size at runtime in Linux

In Linux, one can specify the system's default receive buffer size for network packets, say UDP, using the following commands: sysctl -w net.core.rmem_max= sysctl -w net.core.rmem_default= But I wonder, is it possible for an…
Mαzen
  • 535
  • 2
  • 7
  • 14
27
votes
5 answers

UDP hole punching implementation

I am trying to accomplish UDP hole punching. I am basing my theory on this article and this WIKI page, but I am facing some issues with the C# coding of it. Here is my problem: Using the code that was posted here I am now able to connect to a remote…
brooc
  • 448
  • 2
  • 6
  • 10
27
votes
1 answer

Apache MINA server closes active UDP "session" after 60s

My client-server app works with Apache MINA at both, client and server sides. Sending data via UDP works OK, but after a minute server closes the connection (or MINA's way - "session") and stops answering. The strange part is that the connection is…
Jakub Turcovsky
  • 2,096
  • 4
  • 30
  • 41
27
votes
2 answers

Sending UDP Packet in C#

I have a game server (WoW). I want my players to download my custom patches to the game. I've done a program that checks for update/downloading things. I want my program to send a packet to my game server if player have all my patches. I dont need…
DOminik
  • 281
  • 1
  • 3
  • 4
27
votes
2 answers

Reading from udp port in browser

Aside from Java Applet, is there anyway we can read from an UDP socket? I know websockets are TCP sockets, but I need to communicate with a server via udp sockets, anything in HTML5, or anything at all? I have looked at this post from: two years ago…
C graphics
  • 7,308
  • 19
  • 83
  • 134
27
votes
3 answers

What are the chances of losing a UDP packet?

Okay, so I am programming for my networking course and I have to implement a project in Java using UDP. We are implementing an HTTP server and client along with a 'gremlin' function that corrupts packets with a specified probability. The HTTP server…
Cory Gross
  • 36,833
  • 17
  • 68
  • 80
27
votes
4 answers

Broadcasting a message using nc (netcat)

I'm trying to send a broadcast message using netcat. I have firewalls open and sending a regular message like this works for me: host: nc -l 192.168.1.121 12101 client: echo "hello" | nc 192.168.1.121 12100 But I can't get something like this…
Edwin Evans
  • 2,726
  • 5
  • 34
  • 47
26
votes
2 answers

What are the use cases of SO_REUSEADDR?

I have used SO_REUSEADDR to have my server which got terminated to restart without complaining that the socket is already in use. I was wondering: are there other uses of SO_REUSEADDR? Has anyone used the socket option for other than said purpose?
Prabhu. S
  • 1,743
  • 2
  • 21
  • 34
26
votes
1 answer

C# UDP Broadcast and receive example

Problem: I am trying to bind a udp socket on a specific address. I will broadcast out a message. That same socket will need to be able to receive messages. Current code: static void Main() { UdpClient Configuration = new UdpClient(new…
Jason
  • 2,147
  • 6
  • 32
  • 40
26
votes
2 answers

Why DNS uses UDP as the transport layer protocol?

Why DNS uses UDP as the transport layer protocol?
Ada S
  • 409
  • 2
  • 5
  • 8
26
votes
2 answers

What is the best way to do Bit Field manipulation in Python?

I'm reading some MPEG Transport Stream protocol over UDP and it has some funky bitfields in it (length 13 for example). I'm using the "struct" library to do the broad unpacking, but is there a simple way to say "Grab the next 13 bits" rather than…
ZebZiggle
  • 678
  • 2
  • 9
  • 11