[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Simple udp echo problem
- Date: Mon, 28 Jan 2008 12:24:33 +0200
- From: leonp at plris.com (Leon Pollak)
- Subject: Simple udp echo problem
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