joshua@athertn.Atherton.COM (Sleaze Hack) (12/09/88)
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
joshua@athertn.Atherton.COM (Sleaze Hack) (12/14/88)
Thanks to everyone who responded to my cry for help. It seems that SunOS 3.4 is the _SunOS from Hell_ and has many known TCP bugs. Several people suggested replacing the TCP code with the newer "Van Jacobson" TCP code. This in ucbarpa.berkeley.edu:pub/43net/tcp.tar.Z (or something similar). You can annonymously ftp it. John A. Shriver (jas@proteon.com) pointed out that there was an option to setsockopt which did exactly what I wanted, but was only available in 4.3bsd. With 4.2bsd I needed to patch the kernal which adjusts the space globally. The kernal variables are tcpsendspace and tcprcvspace. Josh -------- Quote: "If you haven't ported your program, it's not Addresses: a portable program. No exceptions." joshua@atherton.com OR sun!athertn!joshua OR {backbone}!{decwrl!hpda}!athertn!joshua work:(408)734-9822 home:(415)968-3718