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
20
votes
3 answers

Receiving a response through UDP

I have seen applications send a packet through UDP to an IP on some port and receiving a response. Which port does the response go to? (Btw, how can the router know that the response is for my PC, if there are no ports forwarded to my…
Neo_b
  • 201
  • 1
  • 2
  • 3
20
votes
2 answers

Send Broadcast UDP but not receive it on other Android devices

I am trying to develop an app that sends some broadcast messages and receives some answers from the other android devices. I am having some trouble receiving the UDP messages from the other devices. I should mention that this code worked on…
Lara
  • 781
  • 3
  • 8
  • 21
20
votes
1 answer

Making recvfrom() function non-blocking

I am working on a UDP server/client application. For finding out if any of the client is down, the server sends a handshake message to the client. Then, the server waits for the response of client to send some data to assure that the client is…
Ayse
  • 2,676
  • 10
  • 36
  • 61
20
votes
3 answers

TCP and UDP same ports, different process

I know you can't have two different process using the same port, but what happens if one is using tcp and the other one udp? Can you have two different process each one binding a socket to the same port but different protocol?
Cristiano Coelho
  • 1,675
  • 4
  • 27
  • 50
20
votes
4 answers

C - choose interface for UDP/multicast socket

I am trying to modify a multicast listener / sender example to bind the UDP / multicast socket to a specific interface and not using the INADDR_ANY macro. I possess the IPv4 address of the interface. I tried the following, but the socket does not…
user22602
  • 309
  • 1
  • 2
  • 4
20
votes
1 answer

Python UDP Broadcast not sending

I am trying to UDP broadcast from a Python program to two LabView programs. I cannot seem to get the broadcast to send and I am not sure where my socket initialization is wrong, broadcasting seems simple enough?? As far as I can see, there is no…
TDK
  • 255
  • 1
  • 3
  • 9
20
votes
11 answers

Problems with SO_BINDTODEVICE Linux socket option

I have a PC with two network cards. One (eth0) is for LAN/internet and the other for UDP communication with one microcontroller device. The microcontroller has an IP (192.168.7.2) and a MAC address. The second pc network adapter (eth1) has…
Michael
19
votes
3 answers

sending udp broadcast from a docker container

I'm having a few docker containers (Using docker-compose and a single network - network-sol) One of the containers is a Spring Boot application that sends UDP broadcast to the local network. 255.255.255.255 fails because It's the local broadcast…
royB
  • 12,779
  • 15
  • 58
  • 80
19
votes
3 answers

Let two UDP-servers listen on the same port?

I have a client which sends data via UDP-broadcast. (To let's say 127.0.0.255:12345) Now I want to have multiple servers listening to this data. To do so on a local machine, they need to share the port 12345 for listening. My question is, if that is…
MOnsDaR
  • 8,401
  • 8
  • 49
  • 70
19
votes
1 answer

DatagramPacket - will getData always return the same buffer which is passed?

byte [] r = new byte[4096]; DatagramPacket dpr = new DatagramPacket(r, r.length); sock.receive(dpr); After the receive, will dpr.getData() & r always be the same? ex: Can I directly use the byte array r or do I need to call getData() to retrieve…
user93353
  • 13,733
  • 8
  • 60
  • 122
19
votes
2 answers

Difference between a TCP Socket and a Connected UDP Socket

Default UDP socket plus the Connect() call is a Connected UDP Socket. I know the differences related to TCP and UDP but here I want to know the Difference in just the sockets
arjun gulyani
  • 669
  • 2
  • 8
  • 23
19
votes
16 answers

Broadcast like UDP with the reliability of TCP

I'm working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else hear it and act accordingly. Is there a way that we can broadcast out…
Jeffrey
  • 1,837
  • 5
  • 25
  • 40
19
votes
4 answers

Options for securing UDP Traffic

I'm looking for options for securing UDP traffic (mainly real-time video) on a wireless network (802.11). Any suggestions apart from Datagram Transport Layer Security (DTLS)? Thanks.
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161
19
votes
2 answers

Swift: Receive UDP with GCDAsyncUdpSocket

BACKGROUND: I want to be able to send and receive UDP packets between my iOS app and a server. The server echoes back every incoming message to the client the app. The server is tested and confirmed working. I have a StartViewController which…
0xRLA
  • 3,279
  • 4
  • 30
  • 42
19
votes
1 answer

Python socket.error: [Errno 13] Permission denied

Using Linux and Python, I want to send some data with broadcast: d = b'109u433279423423423' import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.sendto(d, 0, ('192.168.0.255', 9)) I launch this script under root and get this…
atomAltera
  • 1,702
  • 2
  • 19
  • 38