Setting the Type-Of-Service/TOS Byte within an IP frame in UDP.

Giganews Newsgroups
Subject: Setting the Type-Of-Service/TOS Byte within an IP frame in UDP.
Posted by:  Tim Hyde (timhy…@c21technology.com)
Date: Tue, 13 Dec 2005

I am really frustrated.  I want to set the TOS setting of UDP packets that I
am sending out.  There is no option in the incomplete version of SetSockOpt
within Tidsockethandle - the flag I should be using IP_TOS is not supported
and an exception is thrown.

No problem I thought, I'll just set it using the WinSock funtion and
everything will be okay.  Well this works fine, I can set it, and I can read
it back, but does this setting show up in the actual UDP packet I send out -
No.

Would really appreciate any ideas.  I am surprised that this is not a built
in option as without it VoIP apps are a definate no-no.

The code to set and get the TOS follows:
//#####################################################################
//
//#####################################################################
procedure TDummy.SetTOS();
var tos:BYTE; Len:Integer;
begin
tos:=$B8; len:=1;
//Skt.Binding.SetSockOpt(IPPROTO_IP,IP_TOS,@tos,1); //This throws the
exception too.
Len:=1; SetSockOpt(Skt.Binding.Handle,IPPROTO_IP,IP_TOS,@tos,Len);
end;
//#####################################################################
//
//#####################################################################
procedure TDummy.GetTOS();
var tos:BYTE; Len:Integer;
begin
tos:=0;
//Skt.Binding.GetSockOpt(IPPROTO_IP,IP_TOS,@tos,1); //This throws the
exception.
Len:=1; GetSockOpt(Skt.Binding.Handle,IPPROTO_IP,IP_TOS,@tos,Len);
OutputDebugString(PChar(Format('TOS = %.2X  ',[tos])));
end;

Regards,

Tim

Replies