[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash sockets: printf \x0a does TCP fragmentation

From: Ilkka Virta
Subject: Re: bash sockets: printf \x0a does TCP fragmentation
Date: Sat, 22 Sep 2018 13:30:02 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 22.9. 12:50, address@hidden wrote:
cat has a problem with binary chars, right? And: see below.

No, it just loops with read() and write(), it shouldn't touch any of the bytes (except for cat -A and such). But it probably doesn't help in coalescing the write blocks, it's likely to just write() whatever it gets immediately.

And you can't really solve the issue at hand by piping to any intermediate program, as that program couldn't know how long to buffer the input. Unless you use something that buffers for a particular amount of time, which of course causes a unnecessary delay.

The coreutils printf seems to output 'foo\nbar\n' as a single write, though (unless it goes to the terminal, so the usual stdio buffering), so you might be able to use that.

In any case, if a TCP endpoint cares about getting full data packets within a single segment, I'd say it's broken.

Ilkka Virta / address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]