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." http://msdn.microsoft.com/en-us/library/ms738586(VS.85).aspx

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

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


Francois

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

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);
var
 Len: Integer;
 Result: Integer;
begin
 try
   Len := 1;
   Result := WSocket_SetSockOpt(aTWSocket.Handle, IPPROTO_IP, IP_TOS,
@aToS, Len);
   if Result = 0 then
     Log('ToS set')
   else
     Log('ToS not set: Errorcode ' + IntToStr(Result));
 except
   on E: Exception do
     Log('ToS not set: ' + E.Message);
 end;
end;



 Stefan Paege


elektronik-labor CARLS GmbH & Co. KG
Bergweg 6
48485 Neuenkirchen
GERMANY
Telefon: +49 (0) 5973 / 9497-23
Telefax: +49 (0) 5973 / 9497-19
E-Mail: pa...@el-carls.de
Internet: www.el-carls.de

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 http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to