Thanks, that is helpful.

It is now clear to me that the default on OpenBSD for SSIZE_MAX is
2^31 - 1 or greater.  However, I still run into problems on writes to
a TCP/IP socket with sizes exceeding something like 32000 bytes
(probably 2^15 -1).

Is it possible that TCP sockets have a smaller SSIZE_MAX or could this
be a bug?  I am handling partial reads and writes correctly as far as
I can see.  Chopping big writes into chunks smaller than 32000 seems
to solve the problem.

Dave

On 1/16/20, Martin Wanvik <[email protected]> wrote:
> tor. 16. jan. 2020 kl. 14:52 skrev Raymond, David <[email protected]>:
>>
>> Hmm....
>>
>> Thought I found a 2^15 -1 version of SSIZE_MAX in the includes, but I
>> guess I was mistaken.
>
> Not necessarily. What you have probably seen is _POSIX_SSIZE_MAX
> (which is almost literally
> what you wrote in your first post), defined in limits.h to be 32767
> (2^15 - 1). But that
> specifies the minimum value that SSIZE_MAX can have and still conform
> to the POSIX standard.
> So the actual SSIZE_MAX may well be (and usually is) much bigger, as
> others have pointed out.
>
>> 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.
>
>


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

Reply via email to