Path: utzoo!utgpu!watmath!clyde!bellcore!rutgers!gatech!ncar!ames!pasteur!ucbvax!hplabs!pyramid!athertn!joshua
From: joshua@athertn.Atherton.COM (Sleaze Hack)
Newsgroups: comp.protocols.tcp-ip
Subject: Writing more than 2K to a TCP socket
Message-ID: <249@olive.athertn.Atherton.COM>
Date: 8 Dec 88 21:22:16 GMT
Reply-To: joshua@Atherton.COM (Sleaze Hack)
Distribution: na
Organization: Atherton Technology, Sunnyvale, CA
Lines: 28

I'm having trouble sending large blocks of data through a TCP socket.
When I use this code:

	size = 16 * 1024 ;
	stat = write(tcp_sock, buffer, size)

Bad things happen.  Depending on the exact value of size, I get a stat
of -1, or the write just freezes, or the data sent gets zero'ed. If
size is set to 2K or less everything works fine.  I'm using a Sun 3/140
with SunOS 3.4, but the solution to this problem should be portable to
SunOS 3.X, SunOS 4.X, Ultrix 2.X, and Wollengong/VMS, or at least not
break anything in those environments.

Currently, I have a for loop which breaks large packets up, and sends them
in 2K chunks.  This works.  It would be nice if I could speed up the
resulting code, however.  I'm hoping that fewer, larger write calls will
be faster, if I can make it work.  If there are other TCP speed ups, I'd
like to hear about those, also.  Thanks.

Does this problem have anything to do with the "high water mark" which
TCP(4) says has not yet been implemented?

Josh
--------                Quote: "Oh no! Its the ioctl call from Hell!"
Addresses:                      
joshua@atherton.com OR         
sun!athertn!joshua  OR                 
{backbone}!{decwrl!hpda}!athertn!joshua  work:(408)734-9822 home:(415)968-3718