Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help w/ UDP Protocol

0 views
Skip to first unread message

Hasani

unread,
Mar 17, 2003, 10:34:38 PM3/17/03
to
when I use sendto(), I always send more than the amount I requested. e.x.:
If I request 8192 bytes to be sent, 8208 bytes get sent.
Is it because it's including the the sockaddr_in struct of of the socket
that's sending the data? If so, if I call sizeof() on the struct, will the
value vary on diff platforms?


Phil Frisbie, Jr.

unread,
Mar 18, 2003, 11:52:08 AM3/18/03
to
Hasani wrote:
> when I use sendto(), I always send more than the amount I requested. e.x.:
> If I request 8192 bytes to be sent, 8208 bytes get sent.

Is this on Ethernet, or a PPP connection? Are you using a packet sniffer to
determine this? Actually, I calculate you should be sending a lot more than that
on the physical network...

> Is it because it's including the the sockaddr_in struct of of the socket
> that's sending the data? If so, if I call sizeof() on the struct, will the
> value vary on diff platforms?

UDP is built on top of IP. The IP header is 20 bytes, and the UDP header is 8
bytes, so sending 8192 bytes actually should be sending 8210 bytes. HOWEVER, on
10baseT Ethernet your 8192 bytes will broken up into chunks of no larger than
1472 bytes plus the UDP header of 8 bytes and the IP header of 20 bytes and the
Ethernet frame overhead of 6 bytes. So, your total bytes sent over Ethernet will
be at least 8396.

--
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com

Hasani

unread,
Mar 19, 2003, 10:10:27 AM3/19/03
to
well, 8208 was the value returned by sendto(). I am doing this over a lan
and also having the sender send a udp packets to itself. I'm using ethernet
here.

"Phil Frisbie, Jr." <ph...@hawksoft.com> wrote in message
news:3E774EA6...@hawksoft.com...

Hasani

unread,
Mar 18, 2003, 8:10:23 PM3/18/03
to
well, 8208 was the value returned by sendto(). I am doing this over a lan
and also having the sender send a udp packets to itself. I'm using ethernet
here.

"Phil Frisbie, Jr." <ph...@hawksoft.com> wrote in message
news:3E774EA6...@hawksoft.com...

Phil Frisbie, Jr.

unread,
Mar 20, 2003, 11:24:12 PM3/20/03
to
Hasani wrote:
> well, 8208 was the value returned by sendto(). I am doing this over a lan
> and also having the sender send a udp packets to itself. I'm using ethernet
> here.

That does not make sense. You mean you are calling sendto() like this:

buflen = 8192;

len = sendto(socket, buffer, buflen, 0, &addr, addrlen);

And len is set to 8208?

Here is a simple question, are you using 8192 as the third parameter, or a sizeof()?

> "Phil Frisbie, Jr." <ph...@hawksoft.com> wrote in message
> news:3E774EA6...@hawksoft.com...
>
>>Hasani wrote:
>>
>>>when I use sendto(), I always send more than the amount I requested.
>>
> e.x.:
>
>>>If I request 8192 bytes to be sent, 8208 bytes get sent.

0 new messages