# HG changeset patch # User Claus Gittinger # Date 1067285903 -3600 # Node ID eb9b1f1340e52d13dfbc3ce5434476bdc6117634 # Parent cc973a42aa5490dcd3a1d1c19b34365da52b74fb setTCP_NODELAY diff -r cc973a42aa54 -r eb9b1f1340e5 Socket.st --- a/Socket.st Fri Oct 24 12:34:55 2003 +0200 +++ b/Socket.st Mon Oct 27 21:18:23 2003 +0100 @@ -3608,10 +3608,37 @@ #endif %}. ^ false +! + +setTCP_NODELAY:aBoolean + "enable/disable TCP_NODELAY (i.e. disable/enable the Nagle algorithm) + For special applications only. + Not all OperatingSystems offer this functionality + (returns false, if unsupported)" + + filePointer isNil ifTrue:[ + ^ self errorNotOpen + ]. +%{ +#if defined(TCP_NODELAY) && defined(IPPROTO_TCP) + int onOff = (aBoolean == true); + + if ((aBoolean == true) || (aBoolean == false)) { + OBJ fp = __INST(filePointer); + int sock; + int onOff = (aBoolean == true); + + sock = fileno(__FILEVal(fp)); + setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&onOff, sizeof(int)); + RETURN(true); + } +#endif +%}. + ^ false ! ! !Socket class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.192 2003-10-24 10:34:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.193 2003-10-27 20:18:23 cg Exp $' ! !