Simple udp echo problem

Leon Pollak leonp at plris.com
Mon Jan 28 10:24:33 UTC 2008


Hello, all.

Please, help me - I am stick with strange problem with my own udp echo.
The netdemo application works fine in all modes and I decided to do what I 
need. 
After some time I noticed that my udp echo does not echoes packages shorter 
then 18 bytes!? All the packages longer then that are echoed fine.
The package of, let's say 10 bytes, arrives up to the driver and is sent, but 
sniffer does not see it at all. The sendto function returns 10, but...

The code is very straight - in some dedicated task:

static struct sockaddr_in myAddr;
static struct sockaddr farAddr;
static socklen_t farAddrLen=sizeof(farAddr);
static int  so, InLen;
static char Buf[256];
int res;
	so = socket(AF_INET, SOCK_DGRAM, 0);
	myAddr.sin_family	= AF_INET;
	myAddr.sin_port		= htons(777);
	myAddr.sin_addr.s_addr	= htonl (INADDR_ANY);
	bind(so, (struct sockaddr *)&myAddr, sizeof (myAddr));
	while(1) {
		InLen = recvfrom(so, Buf, 256,   0, &farAddr, &farAddrLen);
		res   = sendto  (so, Buf, InLen, 0, &farAddr, sizeof(farAddr));
	};


I shall be very thankful for any hint where to look for the problem.

-- 
Leon



More information about the users mailing list