[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

udp sockets

toobee84@googlemail.com

12/2/2008 10:33:00 AM

hi,

i am looking around the internet for a while now..... with no helpful
results.

i'm using udp-socket in a program what works fine so far until the
point i try to send a package with a size that exceeds the usual
~1500Byte/package.
the sendto()-call gives me then a "Message too long" error. Do i have
to make the fragmentation of the package myself or does the socket-API
provides any function to split the packages ?

if i have to do it myself how can i set the fragmentation bit in the
header file to tell the "socket" that i'm sending a splitted package?
(i know that i can use raw-sockets to set the whole header but that
have to work with usual SOCK_DGRAM somehow?)

can someone gives me a clue or a answer, i need to send udp-packages
(or split them) with a total size of 10.000 - 30.000 Byte

2 Answers

jt

12/2/2008 10:47:00 AM

0

On Tue, 02 Dec 2008 02:33:26 -0800, toobee84@googlemail.com wrote:

> hi,
>
> i am looking around the internet for a while now..... with no helpful
> results.
>
> i'm using udp-socket in a program what works fine so far until the point
> i try to send a package with a size that exceeds the usual
> ~1500Byte/package.
> the sendto()-call gives me then a "Message too long" error. Do i have to
> make the fragmentation of the package myself or does the socket-API
> provides any function to split the packages ?
>
> if i have to do it myself how can i set the fragmentation bit in the
> header file to tell the "socket" that i'm sending a splitted package? (i
> know that i can use raw-sockets to set the whole header but that have to
> work with usual SOCK_DGRAM somehow?)
>
> can someone gives me a clue or a answer, i need to send udp-packages (or
> split them) with a total size of 10.000 - 30.000 Byte

And your C++ *language* question was...?

Please see:

http://www.parashift.com/c++-faq-lite/how-to-post.ht...

--
Lionel B

Maxim Yegorushkin

12/2/2008 10:50:00 AM

0

On Dec 2, 10:33 am, "toobe...@googlemail.com"
<toobe...@googlemail.com> wrote:

> i am looking around the internet for a while now..... with no helpful
> results.
>
> i'm using udp-socket in a program what works fine so far until the
> point i try to send a package with a size that exceeds the usual
> ~1500Byte/package.
> the sendto()-call gives me then a "Message too long" error. Do i have
> to make the fragmentation of the package myself or does the socket-API
> provides any function to split the packages ?

What operating system are you using?

If it is Linux, then man udp(7):

http://www.kernel.org/doc/man-pages/online/pages/man7/...
<q>
By default, Linux UDP does path MTU (Maximum Transmission Unit)
discovery. This means the kernel will keep track of the MTU to a
specific target IP address and return EMSGSIZE when a UDP packet
write exceeds it. When this happens, the application should
decrease the packet size. Path MTU discovery can be also turned
off using the IP_MTU_DISCOVER socket option or the
/proc/sys/net/ipv4/ip_no_pmtu_disc file; see ip(7) for details.
When turned off, UDP will fragment outgoing UDP packets that
exceed the interface MTU. However, disabling it is not
recommended for performance and reliability reasons.
</q>

--
Max