You should call WSAGetLastError to know why the call fails.
Also you must be sure to call your function at a time that the Handle property is initialized.

By the way, in the description for IP_TOS, I read the following: "Do not use. Type of Service (TOS) settings should only be set using the Quality of Service API. See Differentiated Services in the Quality of Service section of the Platform SDK for more information."

The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)

----- Original Message ----- From: "Stefan Paege" <>
To: "'ICS support mailing'" <>
Sent: Monday, October 11, 2010 1:22 PM
Subject: Re: [twsocket] Quality of Service?


In a TWSocket you have access to the low level socket ahndle using
Handle property. You can issue winsock API function call using that

So the following code should work!?
WSocket_SetSockOpt does not throw an exception but returns -1.
What kind of error is this?
Any errors I would expect are in the 100xx or 110xx range.

procedure SetToS(aTWSocket: TWSocket; aToS: Byte);
 Len: Integer;
 Result: Integer;
   Len := 1;
   Result := WSocket_SetSockOpt(aTWSocket.Handle, IPPROTO_IP, IP_TOS,
@aToS, Len);
   if Result = 0 then
     Log('ToS set')
     Log('ToS not set: Errorcode ' + IntToStr(Result));
   on E: Exception do
     Log('ToS not set: ' + E.Message);

 Stefan Paege

elektronik-labor CARLS GmbH & Co. KG
Bergweg 6
48485 Neuenkirchen
Telefon: +49 (0) 5973 / 9497-23
Telefax: +49 (0) 5973 / 9497-19

Kommanditgesellschaft: Sitz Neuenkirchen, Registergericht Steinfurt HRA 3310

Persönlich haftende Gesellschafterin: elektronik-labor CARLS,
Beteiligungsgesellschaft mbH, Sitz Neuenkirchen, Registergericht Steinfurt
HRB 4175

Geschäftsführer: Irmgard Carls, Joachim Schulte, Helmut Schiffelholz

To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to