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.

618 questions
135
votes
3 answers

What's the difference between streams and datagrams in network programming?

What's the difference between sockets (stream) vs sockets (datagrams)? Why use one over the other?
RoR
  • 13,894
  • 21
  • 65
  • 92
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,805
  • 1
  • 18
  • 25
41
votes
7 answers

Unix Domain Socket: Using datagram communication between one server process and several client processes

I would like to establish an IPC connection between several processes on Linux. I have never used UNIX sockets before, and thus I don't know if this is the correct approach to this problem. One process receives data (unformated, binary) and shall…
BigMick
  • 433
  • 1
  • 4
  • 7
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
  • 12,985
  • 7
  • 50
  • 106
18
votes
1 answer

What is the max size of AF_UNIX datagram message in Linux?

Currently I'm hitting a hard limit of 130688 bytes. If I try and send anything larger in one message I get a ENOBUFS error. I have checked the net.core.rmem_default, net.core.wmem_default, net.core.rmem_max, net.core.wmem_max, and…
Jaime
  • 1,052
  • 2
  • 12
  • 26
18
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,452
  • 1
  • 14
  • 35
17
votes
3 answers

Non-blocking UDP I/O vs blocking UDP I/O in Java

Non-blocking TCP/IP SocketChannels and Selector in NIO help me to handle many TCP/IP connections with small number of threads. But how about UDP DatagramChannels? (I must admit that I'm not very familiar with UDP.) UDP send operations don't seem…
trustin
  • 11,651
  • 6
  • 36
  • 49
16
votes
1 answer

NEPacketTunnelProvider Sniffer iOS

As I recently found this paper describing a sniffing mechanism for iOS using Apple's NEPacketTunnelProvider Extension, I got curious and it made me want to understand it from a technical point of view. As I usually don't work at a deep network layer…
thellmei
  • 223
  • 1
  • 9
15
votes
4 answers

Sending packets to 255.255.255.255 by Java DatagramSocket fails

I'm programming a networking program in java , and I want to send some Packets to 255.255.255.255, but it fails , even when I send them to 192.168.1.255, which according to the output of ifconfig command , is the broadcast address. But when I send…
Pro.Hessam
  • 799
  • 3
  • 10
  • 26
14
votes
2 answers

Are datagrams always received completely?

Most datagram receiving functions such as c's recv or read, javas DatagramPacket class or pythons SocketServer, include the possibility to find out the amount of received data. c: int amount = recv(sock, buf, n, MSG_WAITALL); java: int amount =…
XZS
  • 2,124
  • 2
  • 16
  • 35
14
votes
4 answers

Why do I get UDP datagrams out of order even with processes running locally?

I'm developing a java interface between a streaming server and a flash client. I noticed that UDP datagrams can reach my interface out of order even if both processes are running locally. Is that normal? I thought that as no datagram has to go…
Bilthon
  • 2,435
  • 8
  • 33
  • 44
14
votes
2 answers

is DatagramSocket.send thread safe?

I'm planning to use an instance of DatagramSocket and call its send method from different threads... to send UDP packets to different clients. Is the method thread safe i.e. calling this method from different threads will not create any…
Shafiul
  • 2,562
  • 7
  • 30
  • 53
12
votes
2 answers

Some java Datagram Socket questions

I have recently nose dived into socket programming using java, and I have a few general sort of questions. There is a bind() method, as well as a connect() and disconnect(). There is no unbind(). Is this because upon disconnecting the socket is…
Cat
  • 147
  • 1
  • 1
  • 7
11
votes
1 answer

Why is netcat unable to receive the second broadcast message?

While experimenting with broadcast messages (on a Debian 8.3 VM running on VirtualBox 5.0.14 on a Windows 7 laptop) I found that netcat (nc) receives only the first broadcast message. It does not receive the second broadcast message. Programs Here…
Susam Pal
  • 27,101
  • 9
  • 71
  • 93
11
votes
2 answers

Whats the difference between a socket which is open and a socket which is connected?

The Java Socket class has two methods isClosed and isConnected to check whether the socket is closed or connected respectively. I wanted to know what's the difference between a TCP socket which is only open and a TCP socket which is open and…
Aadit M Shah
  • 67,342
  • 26
  • 146
  • 271
1
2 3
41 42