Questions tagged [datagram]

A datagram is a unitary message delivered entire over a network, typically via UDP, and typically with no guarantee on order or reliability of message delivery.

Datagrams support connection-less messages of a fixed maximum length. While datagrams allow for a bi-directional data flow, the order and reliability of message delivery is not guaranteed. A process receiving datagrams may find messages duplicated or missing or in an order different than the order sent. However, record boundaries in data are respected. Datagrams closely model the facilities found in many contemporary packet-switched networks.

630 questions
2
votes
2 answers

Append Int to Data in Swift 3

I am writing datagram for sending it to a server via UDP socket. How can I append Int to the end of a datagram (already composed Data)?
Olex
  • 1,656
  • 3
  • 20
  • 38
2
votes
2 answers

Listening datagram socket with any ip and any port number android

Hi Am sending broadcast using DatagramSocket with specific port number. Its successfully send message. But when i listening for receive message with open ip address and any port number it throwing sockettimeoutexception. But am connected with the…
Nas
  • 2,158
  • 1
  • 21
  • 38
2
votes
0 answers

DatagramChannel.receive blocks on VPN

I am learning about DatagramChannel Multicast, I am trying to do the following ,i noticed that the DatagramChannel#receive method blocks completely when i am on VPN and does not receive anything , but data gets printed few iterations when i…
chebus
  • 762
  • 1
  • 8
  • 26
2
votes
3 answers

File descriptor of a java datagram socket

How do I get the file descriptor of a Java Datagram socket? I've searched the web without any success. Srini
Srini
  • 21
  • 2
2
votes
1 answer

Node.js dgram bind on udp6 and udp4 throws EADDRINUSE

I have recently upgraded my node.js version from 0.10.31 to 4.0.0 by installing n via npm and then called n stable. With the new node version, my existing code broke. This code: var d = require("dgram"); var s =…
the_tiger
  • 346
  • 1
  • 9
2
votes
2 answers

Socket not closing properly

I am trying to create a UDP listener that will listen on a separate thread. It works fine the first time but when I stop the connection and then start it again it gives me errors. listenerRunnable = new Runnable() { public void run() { …
Mike
  • 1,481
  • 6
  • 17
  • 22
2
votes
2 answers

How to check if a response packet is received within a particular time limit?

Suppose a client sends server a request. The server responds with an ACK. However, if the server does not respond within two seconds, the code terminates. socket.receive(ack); is a blocking call. However, I assumed that if I disconnected the socket…
2
votes
1 answer

Java DatagramChannel - Cannot ping port from external network

I am writing a server which uses a DatagramChannel (non-blocking) to send/receive data. It works flawlessly on my local network, but if I try to connect to it using the client application from a different network (i.e. over the internet), I cannot…
Ben Hayward
  • 1,444
  • 23
  • 37
2
votes
1 answer

How can I use an EventExecutorGroup with an NioDatagramChannel in Netty?

I'm new to Netty, but I've worked with NIO a bit recently. I'm building a UDP server, and it seems from the examples I've tried that unlike the NioServerSocketChannel.class, when you use the NioDatagramChannel.class you cannot assign an…
mal
  • 3,022
  • 5
  • 32
  • 62
2
votes
2 answers

UDP connections and security

The connection-oriented semantics of TCP indicate that a socket can only connect to one endpoint at a time. But with UDP, a single open socket can send/receive datagrams to/from any number of endpoints. My understanding is that most operating…
Siler
  • 8,976
  • 11
  • 64
  • 124
2
votes
1 answer

DatagramChannel SocketException "Invalid argument"

My code is throwing a SocketException upon calling send() in DatagramChannel. The javadoc doesn't even mention that this is possible. I found a post somewhere advising the use of the IPv4 stack using "-Djava.net.preferIPv4Stack=true", this didn't…
jurgen
  • 325
  • 1
  • 11
2
votes
0 answers

Why String's output value is not updating

DatagramSocket ds = new DatagramSocket(this.my_listening_port); byte[] rcv_data = new byte[1024]; DatagramPacket dp = new DatagramPacket(rcv_data,rcv_data.length); String rcv_data_string[] = new String[no_of_child_node]; for(int…
2
votes
1 answer

java datagramchannel data loss

I've read some conflicting things about how UDP/Java datagram channels operate. I need to know a few things: Does UDP have an inherit way to tell if the packet that is received whole, and in order, before .read(ByteBuffer b) is called? I've read in…
2
votes
3 answers

Received UDP packet length

How to get the length of received UDP packet? Using wireshark I could see the correct length of datagram. How can I print this value in my simple udp server program? I am receiving binary data (Non printable ascii characters as a data) So I can not…
user271757
  • 23
  • 1
  • 4
2
votes
1 answer

DatagramChannel.receive() causes an IndexOutOfBoundsException

First of akk, I know that there is an almost the same question here, but it has no answer. So I'm asking again. In my Android app, I use a non-blocking UDP socket to do some broadcast job, so I choose DatagramChannel. As I ran the following code on…
J Jiang
  • 1,452
  • 10
  • 14