udp

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() { //This thread will listen keep listening to the UDP traffic and put it to the log...

An event delivery library in Java?

Hi, I'm looking for a library that will allow me to deliver simple text events from the server to the clients via sockets. Something simple and lightweight. I can write it myself, but decided to check if such thing exists first. The idea is that there's an application that generates events (such as order rejected or an internal error occ...

Is it possible to send udp packet via a v6 socket to a v4 dst?

when I use linux's "sendto(....)" to send some udp packet, I got "invalid argument" error from system. After some check, I found that I try to send a udp packet via a v6 socekt to a ipv4 destination , I'm not sure whether it is the reason why "invalid argument" comes from system, so want to raise my question here. ...

UDP client-server question

Hello, I'm trying to write a client-server console application on C# using UDP. And i have one question. So, when i send command from client to server - servers must have a read IP adress. client must get some settings from server,but in this case client must have real IP adress too. Other application like games do not require client rea...

Send and receive IPv6 link-local multicast UDP datagrams in Python?

This following is a straightforward IPv4 UDP broadcast, followed by listening on all interfaces. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, True) sock.bind(("", 1337)) sock.sendto("hello world", ("255.255.255.255", 1337)) while True: data, addr = sock.recvfrom(0x10...

Error "No such device" in call setsockopt

Hello, everyone! I need help! I have a code in which send multicast datagrams. A critical piece of code: uint32_t port; int sockfd, err_ip; const uint32_t sizebuff = 65535 - (20 + 8); unsigned char *buff = (unsigned char *) malloc(sizebuff); struct sockaddr_in servaddr, cliaddr; struct in_...

BPF filtering on more than 3 ports?

Hi there, I have a piece of software which uses BPF filtering on the command line. The packets that I am interested in always have either a source or destination UDP port from the following list: o 1645 o 1646 o 1812 o 1813 Unfortunately, my BPF syntax can only filter a maximum of three ports: udp port (1645 or 1646 or 181...

SSDP on the iPhone

I need to be able to send out a UDP message and also receive one in order to discover SSDP devices on the network from the iPhone. I know that I need to send the packet to the multicast address and my HTTP request needs to look something like this: M-SEARCH * HTTP/1.1 Host: 239.255.255.250:1900 Man: ssdp:discover Mx: 3 ST: "urn:schemas...

Why can't we send a UDP packet from an Android emulator?

My friend and I have a wireless robot dog connected to a wifi network which our computer is plugged into. The computer is running an Android emulator and we are trying to send a UDP packet to the wireless robot dog. If the dog receives it, it should start sending UDP packets back. The program we wrote works outside of the emulator, and u...

Writing C# equivalent of perl code to send and receive through UDP socket?

I want to write code in C# similar to following code in perl. What the code does is sends a message through UDP socket and requests for a TCP Port. The code in perl is as below: # Get a UDP connection to port $proto = getprotobyname('udp'); no strict 'refs'; $udpS = "UDP Socket"; if ( !socket($udpS, AF_INET, SOCK_DGRAM, $proto)...

Unknown Java UDP socket error

I get that exception bellow once in a minute or so. I was getting it very frequently before, but when I changed the parameter in linux allowing more connections this error appears less frequently but is constantly appearing. App is distributed in nature, and makes large number of connections. IOException (udp) with (some real IP address...

Client UDP Socket binding

Hi I am creating UDP socket for a UDP client and sending UDP packets with different port numbers and wait for the reply from the destination for certain amount of time. My doubt is .. Is it possible to re-bind a UDP socket to multiple port numbers(even IP-address) to the same socket FD without closing the socket ?? (I cant use RAW sock...

SO_REUSEPORT on linux

Hi I want to know if SO_REUSEPORT option is enabled in LINUX 2.6 or not ?? If I try to use it and compile my code I get following error 01.c:72: error: `SO_REUSEPORT' undeclared (first use in this function) 01.c:72: error: (Each undeclared identifier is reported only once 01.c:72: error: for each function it appears in.) Using the a...

recvfrom failing with error 11

Hi I am trying out a udpclient program which uses sendto and recvfrom functions. I am setting SO_RCVTIMEO value as 10 seconds for my socket. I am binding the socket to source ipaddress and sourceport. When I check the netstat I can see that there is no other process which is binded with the same values. My bind operation is also succe...

Java - Deprecated API - DataInputStream.readLine

Time to learn TCP/UDP ... Anyways, my prof gave me this example and he said it worked for him. However when I go to compile I get a deprecated API error saying readLine is not in use anymore... :\ Code: import java.io.*; import java.net.*; public class Server{ static Socket clientSocket = null; static ServerSocket serverSoc...

Recommendations for a .NET UDP component

I'm looking for recommedations for a .NET UDP component/library that supports async calls. It can be for .NET 2.0 or later, with our preference being that it supports 4.0. It doesn't have to be free, but of course, free is good too. :-) I know that we could write our own, but time is limited and the budget allows for us to purchase o...

Game Server: Broadcasting UDP packet over Internet?

A friend of mine made a small LAN-playable game, and ask me to change it, so it could be playable over the Internet. I don't want to make huge changes on the client application. When a game is created, the server keep sending UDP BROADCAST packets to tell everyone that a game has been created. Now, I just need to change this BROADCAST i...

Testing against an external UDP API. Where to start?

I'm writing a client library against an API that communicates using UDP through a socket connection. I'm trying to write tests as I go however I'm running into a few problems. Should I just build a testing server and start that up in my test helper? I don't want to hammer the external servers when running my tests. Or should I just moc...

wxPython threaded UDP server

Hi, I am trying to put together a UDP server with a wxPython GUI. Here is a link to the code: UDP Server pastie.org I have linked it as its pretty lengthy. I have successfully got the UDP server running on the thread but I can not figure out how to close the socket when the stopping the thread. At the moment it will kick up a new t...

How to receive UDP packets from any ip and any port?

I wanted to use C#'s UdpClient to listen to any incomming UDP packets. I want to receive packets from any IP and any port. I tried the following: UdpClient udpClient = new UdpClient(0); IPEndPoint ep = new IPEndPoint(IPAddress.Any, 0); byte[] data = udpClient.Receive(ref ep); but without success. Does anyone know whats wrong? Thanks...