Re: Xt Interface?

Arnt Gulbrandsen (agulbra@troll.no)
25 Feb 1997 22:30:48 +0100

To subscribers of the xforms list from Arnt Gulbrandsen <agulbra@troll.no> :

spl@szechuan.ucsd.edu (Steve Lamont)
> In practice, you probably don't need to even register a FL_WRITE
> condition. Just register the FL_READ condition and service the socket
> for reading. You can generally just write to the socket with impunity
> -- I've never had a problem with a write() call blocking for any
> significant time.

write() can block now and then if the send window is small enough
compared to the amount you're writing and you have a little bad luck
with the network. The send window almost always defaults to 4k or
more, often to 16k or more, and you can increase it using something
like

fodder = 49152; /* don't increase this beyond 50k */
if ( setsockopt( fd, SOL_SOCKET, SO_SNDBUF,
(char *)&fodder, sizeof(int) ) < 0 )
syslog( LOG_WARNING, "setsockopt( SO_SNDBUF, %d ): %m", window );

If you expect to write more than about 1k in one go, I advise you to
register and unregister that yucky callback, so your software will be
responsive even when the network is behaving badly.

--Arnt
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/