udp

C++ iptables redirection forming separate packets

I have all traffic from port 50 redirected to 5050 using iptables -t nat -A POSTROUTING -p udp --dport 50 -j REDIRECT --to-port 5050 I listen using a RAW Socket on 5050, and I see IP packets from 0.0.0.0:50 to 0.0.0.0:5050. The original destination address is obviously not present, since this seems to be a separate redirection packet...

UDP Broadcasting for automatic search of servers

I am making a multiplayer networking game. Now to connect to the server, client needs the ip address of the server. So, the way I implement this is as follows. Client Broadcasts its ip address at Broadcast IP and a port say A. Server listens to it over A, and Server creates a new UDP connection with the client behaving as a client say...

What is required to make a UDP Broadcast in C?

I'm working on broadcast, and I'm failing pretty badly at even getting the thing to work. I know I have to do the setsockopt() call, but what is needed before that to ensure that the broadcast will go to every box on the network? I vaguely remember something about complementing the network address or something like that. I appreciate the...

C++ weird RAW sockets and iptables issue...

With reference to http://stackoverflow.com/questions/3951043/c-iptables-redirection-forming-separate-packets, I am facing an extremely peculiar problem now. I am trying to redirect all incoming traffic on UDP port 5060 to port 56790, and all outgoing traffic from 5060 to the port 56789. I used these iptables rules: iptables -t nat -I PR...

Multithreading UDP server with epoll?

Hi all, I'd like to develop a multithreaded UDP server in C/Linux. The service is running on a single port x, thus there's only the possibility to bind a single UDP socket to it. In order to work under high loads, I have n threads (statically defined), say 1 thread per CPU. Work could be delivered to the thread using epoll_wait, so thre...

missing messages when reading with non-blocking udp

I have problem with missing messages when using nonblocking read in udp between two hosts. The sender is on linux and the reader is on winxp. This example in python shows the problem. Here are three scripts used to show the problem. send.py: import socket, sys s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) host = sys.argv[1] s.send...

Mono dropping packets when receiving lots of multicast

I am creating a program that listens to video streams over multicast. Listening to one feed with Mono on Linux works fine but listening to 15 feeds drops packets. Running the code on Windows .NET does not drop packets and listening to the feeds with a C program on Linux does not drop packets. Is there something I could do to optimize thi...

how i can identify which process is making UDP traffic on linux ?

Hello, my machine is continously making udp dns traffic request. what i need to know is the PID of the process generating this traffic. The normal way in TCP connection is to use netstat/lsof and get the process associated at the pid. Is UDP the connection is stateles, so, when i call netastat/lsof i can see it only if the UDP socket...

Sending a C++ struct over UDP in Java

Hi all, I'm a C++ programmer and have a need to set up some UDP communications between a java android app and the C++ server running on a PC. I have structure that I need to receive on the PC that consists of the following: int int float Unfortunately I'm totally at a loss as to how I can do this with Java. I need to create a Datag...

UDP sockets in iPhone background

My iPhone application is using AsyncUdpSocket to handle a UDP socket.But when my application goes background in iOs 4.0 and return back, i am getting following error. Application 'MyAppName' exited abnormally with signal 13: Broken pipe This is because my sockets are disconnected when my application goes to background. How to run ...

Send and receive serialize object on UDP in java

Hi to all of you; I am trying to send a serialized object from a server process to a client process in Java using UDP. The problem is that the client is being blocked on the receive method. Can someone help?! here is the server code for sending the object: ClientModel C1= new ClientModel(100,"Noor","Noor",38,38,"asd"); ByteArrayOu...

Socket programming: sendto always fails with errno 22.

I am always getting no bytes sent, with an errno of 22 (Invalid Argument) with this code. The destination_host is set elsewhere and known to be valid, so I really don't see what is going on. MAXMSGSIZE is 1000. No errors, or warnings. I am compiling with -Wall -Werror -pedantic char *data_rec; u_int data_len; int sockfd; uint16_t *...

How to write a .Net UDP Scalable server

Hello StackOverflow! I need to write a very high load UDP server. I'm using .Net. How do I use the Socket class to achieve this? I am familiar with the winsock API, and completion ports, and what i would do there, is to use several threads to accept sockets using a completion port, and also to receive in the same manner. My server nee...

UDP checksum error c++

I am calculating UDP checksum using the following function (found it somewhere): uint16_t udp_checksum(const void *buff, size_t len, in_addr_t src_addr, in_addr_t dest_addr) { const uint16_t *buf=(const uint16_t *)buff; uint16_t *ip_src=(uint16_t *)&src_addr, *ip_dst=(uint16_t *)&d...

Echo client with over 65% packet losses

Hi! I'm just wondering why my UDP server/client pair is getting 65% packet loss. It's just an echo service that sends (the client) an empty packet when it reaches EOF, and the server resets itself when he gets that empty packet. Not really homework, just frustrated why I can't get it right :( Thanks! ...

UDp Hole Punching

I Trying to implement the UDP Hole Punching. I have a server program which running on Static IP address and port. Client A(behind the NAT and firewall where UDP traffic is allowed) Client B(data card) Client A is running behind NAT (Cisco) and other Client B is running through data card (Reliance India). Both Client A and Client B is...

Problem in getting DHCPINFORM message response from C#

I am developing an application in which I want to pull out some information through the DHCP server. so I am sending a DHCPINFORM packet on port 67 UDP Broadcast. The problem I am facing is that I am not getting response i.e. DHCPACK or anyother message from DHCP server all the times, means some times it send back an DHCPACK packet at on...

WCF discovery using bare UDP

Since ws-discovery is not working for me, I'm searching for alternative solutions with similar functionality. I prefer it simple to set up and maintain, issues like checking for interface matching are of very low importance. Basically, I want to broadcast a message on the local network and retrieve all answering IPs. So my first idea is ...

Are there different ports for output and input?

When sending data using UDP, a destination port is needed to be specified. If sending by TCP, a source port should also be specified. Are there different ports for input and output? E.g., if I specify port 1234, can I use it for both input and output or should I use different ports for output and input? EDIT: To clarify my question: -...

Live video stream on server (PC) from images sent by robot through UDP

Hmm. I found this which seems promising: http://sourceforge.net/projects/mjpg-streamer/ Ok. I will try to explain what I am trying to do clearly and in much detail. I have a small humanoid robot with camera and wifi stick (this is the robot). The robot's wifi stick average wifi transfer rate is 1769KB/s. The robot has 500Mhz CPU and...