[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Simple udp echo problem
- Date: Mon, 28 Jan 2008 13:40:01 +0100
- From: Thomas.Doerfler at embedded-brains.de (Thomas Doerfler)
- Subject: Simple udp echo problem
Hi Leon,
this is just a bad guess:
is it possible that your networking driver does not PAD short transmit
frames to the minimum length of 64 bytes (total packet length)? Some
network controllers (including the *QUICC* family from Freescale) allows
to switch this padding off (or to define the minimum transmit packet
length) and this would make the device send short packets. Most switches
(and receivers) would ignore these packets.
wkr,
Thomas.
Leon Pollak schrieb:
> 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.
>
--
--------------------------------------------
embedded brains GmbH
Thomas Doerfler Obere Lagerstr. 30
D-82178 Puchheim Germany
Tel. : +49-89-18 90 80 79-2
Fax : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request
Diese Nachricht ist keine gesch?ftliche Mitteilung im Sinne des EHUG.