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

How to run a Server without using a while loop?

I'm trying to make a server program using the DatagramSocket and DatagramPacket classes, but my current code uses an ugly while loop which also freezes my program while the server runs, but the server runs fine with no problems. Anyway the code is…
jocopa3
  • 796
  • 1
  • 10
  • 29
3
votes
2 answers

Do you have to close a UDP (dgram) client in Node.js or can you reuse it?

The docs (and a number of libraries I've looked at) seem to indicate that you close the client every time you send: var dgram = require('dgram'); var message = new Buffer("Some bytes"); var client = dgram.createSocket("udp4"); client.send(message,…
Michael Hart
  • 5,109
  • 3
  • 22
  • 21
3
votes
2 answers

How to send Object over Datagram Socket

I am working on some Android Project & trying to pass object over Datagram Socket to some another device Object contains 'String' Data Members of the class ( UserName,Services) .. How can I do that??
manas
  • 31
  • 1
  • 2
2
votes
1 answer

Java UDP STUN Hole Punching with DatagramSocket

I'm trying to to send a udp packet to a client across a NAT, both of us belong to a different NAT, we are familiar with the theory of STUN therefore the way to achieve this is to 'hole punch' our way through via a simple STUN server.. Basically the…
Eric Kong
  • 31
  • 1
  • 3
2
votes
3 answers

DatagramSocket temporarily stops receiving packets (Java)

I have programmed a plugin in Lua for a game that sends player information via a UDP packet (512 bytes) to a remote server that reads the data from the packet and aggregates all player information into an xml file (which can then be viewed on the…
Andrew
  • 245
  • 2
  • 9
2
votes
2 answers

Handle unreachable UDP ports with Java sockets

I'm using a Java DatagramSocket to stream data to multiple different clients. As I handle the list of currently registered clients myself, I only bind the socket to the server port and don't connect to any specific client. However, by not using…
lxgr
  • 3,719
  • 7
  • 31
  • 46
2
votes
1 answer

setSotimeout on a datagram socket

The server acts like an echo server. The clients sends 10 packets to server (1 sec of gap) When Client receives packets from the server, sometimes the packets are lost. So the client has to wait for up to one second for the packet to arrive. If the…
Wasi
  • 1,258
  • 4
  • 14
  • 33
2
votes
1 answer

What is the difference between write and send on NIO channels?

I'm building a UDP communication system with Java NIO, and browsing through the javadoc for the APIs I noticed that channels have a write primitive and a send primitive. I have prototyped and tried both, and nothing seems to change in that they both…
Diferdin
  • 1,252
  • 1
  • 14
  • 30
2
votes
0 answers

Why UDP socket is not working when stored as class member in NodeJS?

I am new to UDP/datagram package in Node, please pardon me if wrong in my conceptual understanding here. I tried creating an abstract class UdpClient using NodeJS dgram package Code is in TypeScript import { deserialize, serialize } from "v8" type…
rishav
  • 288
  • 2
  • 8
2
votes
1 answer

Datagram Channel Sockets not writing Java

Simply said, I'm able to receive data from the connected socket, until about 10 seconds after it starts. The solution to fix this is, to send data to the 'client'(an ARDrone) to keep the data stream going, otherwise it will stop sending data to the…
Matt Pope
  • 167
  • 2
  • 11
2
votes
1 answer

What are the possible return values for send, sendto and sendmsg on a UDP socket on Linux?

These functions return -1 on error and the input length on success. Under what conditions may they return a value less than the length and greater than or equal to 0 for an UDP socket on Linux? This StackOverflow question is similar but in the…
Jeff Garrett
  • 5,863
  • 1
  • 13
  • 12
2
votes
0 answers

Measuring UDP speed

How do I accurately measure the data rate of the router by using UDP? My reference is Wi-Fi SweetSpots it measures the data transfer rate of the router locally (not internet speed) Here's my code now, I'm getting around 700mbs to 800mbs (which is…
NaviRamyle
  • 3,967
  • 1
  • 31
  • 49
2
votes
0 answers

Android Multicasting is not Working on different devices

I am trying to build an android app, which will send messages to all the devices available in the wifi network. So I have decided to implement multicasting . I am testing my app in Nexus5 & Sumsung S4(GT-I9500). My code is working good in both…
Invictus Cody
  • 517
  • 6
  • 17
2
votes
2 answers

Connecting to DTLS in PHP

Is there any way to connect to DTLS socket in PHP? Some undocumented feature maybe, or not so popular extension? For what I've tried, there's no possibility, but I'm always hoping that I'm wrong.
mlask
  • 337
  • 1
  • 9
2
votes
2 answers

Python logging datagram handler

I am having a problem getting the example code shown in the python docs for the logging DatagramHandler, the code shown below gives EOFError exceptions on every datagram received. import socket import logging import cPickle import struct import…
mikip
  • 1,677
  • 6
  • 25
  • 35