Yes, my code deals with the short reads and writes.

On 1/16/20, Otto Moerbeek <[email protected]> wrote:
> On Thu, Jan 16, 2020 at 06:48:30AM -0700, Raymond, David wrote:
>
>> Hmm....
>>
>> Thought I found a 2^15 -1 version of SSIZE_MAX in the includes, but I
>> guess I was mistaken.
>>
>> The real issue is whether doing write(2) to a TCP/IP socket bigger
>> than 2^15 - 1 bytes causes problems.  I am not very experienced in
>> this area.
>
> It should not. But short read and writes are a real thing and code
> should take care, see the example in write(2).
>
>
>       -Otto
>
>>
>> Dave Raymond
>>
>> On 1/15/20, Bryan Steele <[email protected]> wrote:
>> >> I am confused about SSIZE_MAX and read(2)/write(2).  The POSIX
>> >> SSIZE_MAX is something like 2^15 -1.  This seems to be a real
>> >> limitation when writing to a TCP/IP socket, as I learned from
>> >> experience.  However, much larger reads and writes seem to be possible
>> >> to files and UNIX sockets (pipes).  This makes me uneasy, given the
>> >> warning in the man pages for read(2)/write(2).
>> >>
>> >> Any insight on this topic would be appreciated.
>> >>
>> >> --
>> >> David J. Raymond
>> >> [email protected]
>> >> http://physics.nmt.edu/~raymond
>> >
>> > Not in any reasonably modern version of POSIX..
>> >
>> > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
>> >
>> >     {SSIZE_MAX}
>> >     Maximum value for an object of type ssize_t.
>> >
>> > $ grep -R "SSIZE_MAX" /usr/include
>> > ./amd64/limits.h:#define SSIZE_MAX      LONG_MAX        /* max value
>> > for
>> > a ssize_t */
>> >
>> > /usr/include/sys/limits.h:
>> > #ifdef __LP64__
>> > ..
>> > # define LONG_MAX       0x7fffffffffffffffL
>> > ...
>> > #else
>> > ..
>> > # define LONG_MAX       0x7fffffffL
>> >
>> > -Bryan.
>> >
>>
>>
>> --
>> David J. Raymond
>> [email protected]
>> http://physics.nmt.edu/~raymond
>>
>


-- 
David J. Raymond
[email protected]
http://physics.nmt.edu/~raymond

Reply via email to