'KCMLSetClientIP_TOS(iVal)

Get the Type Of Service field used in the Internet Protocol (IP) headers of all outgoing packets from the client.

Arguments

DIM()iVal[in] The one byte value of the field.

Returns

This function returns TRUE on success, or FALSE on failure.

Syntax

The following definition is built into KCML. You do not have to include it in your own code.

$DECLARE 'KCMLSetClientIP_TOS(DIM())

Remarks

This function allows you to manipulate the Type of Service (TOS) field in the Internet Protocol (IP) headers of all outgoing packets from the client. It is the client equivalent of IP_TOS.

Example

DEFSUB 'SetClientDSCP(uValue)
	LOCAL DIM a$1
	LOCAL DIM b$1
	LOCAL DIM z$1
	REM Shift value into top 6 bits
	z$ = BIN((uValue * 2) * 2)
	REM Get old value
	IF ('KCMLGetClientIP_TOS(BYREF b$) == FALSE)
		RETURN FALSE
	END IF
	REM Mask out the old TOS value leaving the lower two bits intact
	b$ = AND HEX(03)
	REM Combine
	a$ = z$ OR b$
	'KCMLSetClientIP_TOS(a$)
END SUB

Note: On Windows 2000 and Windows XP the ability to set IP header TOS bits is disabled by default. To use this feature on these operating systems you must add a DWORD value to the registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters". The value is called "DisableUserTOSSetting" and must be set to 0. See MSDN article KB248611 for more details.

Note also that this setting will force KClient to use Winsock 1 which will disable its IPv6 support.

Further Information

IntroducedKCML 6.20
CompatibilityKClient

See Also

KCMLClosePort, KCMLDebugBackProcess, KCMLGetClientIP_TOS, KCMLOpenPort, KCMLReadPort, KCMLWritePort, KCMLWritePortName

Index of internal $DECLARE functions