[comp.protocols.tcp-ip] how to control the size of TCP packets in BSD 4.3?

jdh@bu-pub.bu.edu (Jason Heirtzler) (03/15/91)

In BSD 4.3 TCP (SunOS/Irix/whatever), is there an easy way to force a write(2) to
immediately push a packet out to the network?  It looks like the kernel wants to
buffer things and some analysis with our network analyzer confirms that large packets
are always being sent (~1500 bytes, which you would expect) regardless of the length
given to the write(2) system call.  Attempts to convince it otherwise, with fsync(2),
or send(2) have no effect.  If I use setsockopt(2) and change SO_SNDBUF it will force
small packets to be sent over the wire, but it seems to also have the undesirable side
effect of reducing the size of what's buffered inside the kernel as well, since then
performance is terrible (more than I guess it should be.)

The reason is that I need to control the size of packets going over the wire (at this
point I'm not real concerned about the size of the various headers) is to do various
performance tests on throughput.

Thanks for your help,

Jason Heirtzler

0004219666@MCIMAIL.COM (Bob Stine) (03/20/91)

> In BSD 4.3 TCP (SunOS/Irix/whatever), is there an easy way to force a
> write(2) to immediately push a packet out to the network?

Get a stream pointer for the socket (fxxsomething or other), and then
issue an "fflush()" call after your writes.

- Bob Stine