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
26
votes
2 answers

How to retrieve both TCP and UDP ports with Nmap?

I need to retrieve both TCP and UDP ports in the same scan with Nmap in the fastest way possible. I'll try to explain it better. If I use the most common command: nmap 192.168.1.1 It retrieves ONLY TCP ports and it is really fast. If I use the…
raz3r
  • 3,071
  • 8
  • 44
  • 66
25
votes
3 answers

unix socket error 14: EFAULT (bad address)

I have a very simple question, but I have not managed to find any answers to it all weekend. I am using the sendto() function and it is returning error code 14: EFAULT. The man pages describe it as: "An invalid user space address was specified for…
aktungmak
  • 409
  • 1
  • 5
  • 13
25
votes
2 answers

Get destination address of a received UDP packet

Upon receiving a UDP packet, I need to respond to the sender with the address he used to send the packet to which I'm replying. The recvfrom call lets me get the address of the sender, but how do I get the destination address of the received…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
25
votes
3 answers

Is it possible to use UDP with socket.io?

I have a game I am working on and I heard that UDP is superior for real-time games. I know that socket.io uses TCP and was wondering if there is some way to switch it to UDP. I tried looking it up but only found posts from around 2012 which said UDP…
Moo
  • 3,369
  • 4
  • 22
  • 41
25
votes
2 answers

UDP send performance in Node.js

I am benchmarking a Java UDP client that continuously sends datagrams with a payload of 100 bytes as fast as it can. It was implemented using java.nio.*. Tests show that it's able to achieve a steady throughput of 220k datagrams per second. I am not…
Lucio Paiva
  • 19,015
  • 11
  • 82
  • 104
25
votes
3 answers

Write to Client UDP Socket in Go

I'm looking for a good solution for a client/server communication with UDP sockets in Go language. The examples I found on the Internet show me how to send data to the server, but they do not teach how to send them back to the client. To…
Aleksandrus
  • 1,589
  • 2
  • 19
  • 31
25
votes
2 answers

Send and receive data on UDP Socket java android

I am able to properly send my data through UDP socket , but when I receive data it keeps on waiting at receive command I don't know what is causing this. Please have a look at my code below. I am able to properly receive data at server side from…
user2539602
  • 618
  • 3
  • 9
  • 18
25
votes
2 answers

How to simulate different NAT behaviours

I am working on Holepunching using UDP and UDT. For the final testing I need to test the application on different NAT types (Symmetric,full cone,restricted cone, port restricted NATs). Is there any method I can simulate these? What I expect here is…
user739711
  • 1,842
  • 1
  • 25
  • 30
24
votes
4 answers

Send Broadcast datagram

I need to send a broadcast datagram to all machine (servers) connected to my network. I'm using NodeJS Multicast Client var dgram = require('dgram'); var message = new Buffer("Some bytes"); var client =…
Wassim AZIRAR
  • 10,823
  • 38
  • 121
  • 174
24
votes
3 answers

A firewall for Android with VpnService. Responses are delivered, but a SocketTimeoutException is thrown

I am implementing a simple firewall for Android using VpnService. My app is similar to ToyVpnService, but it doesn't send raw IP packets to a remote VPN server which would forward them to their destinations. My implementation is here:…
Maksim Dmitriev
  • 5,985
  • 12
  • 73
  • 138
24
votes
6 answers

what happens when tcp/udp server is publishing faster than client is consuming?

I am trying to get a handle on what happens when a server publishes (over tcp, udp, etc.) faster than a client can consume the data. Within a program I understand that if a queue sits between the producer and the consumer, it will start to get…
Shahbaz
  • 10,395
  • 21
  • 54
  • 83
24
votes
4 answers

Is there a standalone library for Google's QUIC?

Google recently released their experimental transport protocol called QUIC as a namespace net.quic in Chrome. I'd love to use it, as it looks perfect for my use case, however I can't seem to find any guide on using it as a standalone library. Is…
liamzebedee
  • 14,010
  • 21
  • 72
  • 118
23
votes
6 answers

Can UDP data be delivered corrupted?

Is it possible for UDP data to come to you corrupted? I know it is possible for it to be lost.
Net Citizen
  • 5,174
  • 8
  • 38
  • 50
23
votes
3 answers

Confusion over how UDP server sends the response back to UDP client

I am writing a UDP based client server and have got pretty much the code, but I am confused about how UDP server sends the response back to UDP client, this is my understanding till now: Suppose a UDP client wants to communicate with a UDP server,…
pjj
  • 2,015
  • 1
  • 17
  • 42
23
votes
3 answers

UDP broadcast packets across subnets

Is it possible to send a UDP broadcast packet to a different subnet through a router? I'm writing an app to discover certain devices on the network, and the PC might be on a different subnet than the devices it's looking for.
Jon B
  • 51,025
  • 31
  • 133
  • 161