Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Sending large packages
From: Nicola Michael Gutberlet (nicola.gutberlet_at_[hidden])
Date: 2010-01-05 05:27:00


Dear all,

Thank you for your replies. I wanted to tell you the error message thrown
when trying to send larger packages but it seems to be solved. I don't know
why or how...

Anyway, it is sensible to check the maximum message size for the
socket/OS/whatever. How do I get the information of the maximum size of
messages I can write/read over my TCP socket? I noticed the option mentioned
by Jason Felice "SO_MAX_MSG_SIZE" but the TCP socket doesn't support it. I
tried to use an own template:

boost::asio::detail::socket_option::integer<SOL_SOCKET, SO_MAX_MSG_SIZE>
cOptionMaxMessageSize;
socket->get_option( cOptionMaxMessageSize );

But this also did not work - resulting in the option value -1.

Best regards,
Nicola

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Oliver Seiler
Sent: 04 January 2010 18:05
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [asio] Sending large packages

On Mon, Jan 4, 2010 at 7:30 AM, Jason Felice <jason.m.felice_at_[hidden]>
wrote:
> On Mon, Jan 4, 2010 at 5:41 AM, Igor R <boost.lists_at_[hidden]> wrote:
>>> Doesn’t anyone have any ideas? Did anyone receive this mail?
>>
>> I guess it's not an asio limitation, but the OS one - you just
>> exceeded the maximum message size for the underlying protocol.
>> On windows you can use SO_MAX_MSG_SIZE socket option to get the maximum
size.
>
> [...] All TCP networks
> have an MTU, and packets larger than this will be sliced up for
> delivery (without affecting the data contained within or the
> guaranteed order of delivery).

And herein lies what the original poster is hitting. The MTU is way
smaller than the ~1MB limit the poster sees, so that isn't likely the
problem (and would typically only be an issue if using UDP).

My guess is the TCP read/write buffers have been exceeded. Original
poster should include more information:
- OS that this is on,
- The actual error codes being encountered.

If you're exceeding the TCP buffer sizes and trying to write in one
chunk, you may be hitting an error like ENOBUFS (no_buffer_space in
boost:error_code). Just a guess though.
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net