GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Feb-2006, 12:33
gaoanyu gaoanyu is offline
New Member
 
Join Date: Jun 2005
Location: Bristol, UK
Posts: 26
gaoanyu is on a distinguished road

Setting ToS field in the IP header, socket programming


Hi friends,

I am new to windows socket programming. I just managed to set up a UDP server and a client, so that the server is able to send UDP packets (read from a file) through the network to the client. In my source code, I can set these information like the following:

CPP / C++ / C Code:
	addr.sin_family = AF_INET;
	addr.sin_port = htons(iPort);
	addr.sin_addr.s_addr = inet_addr(szAddress);

These are fine. However, my particular application needs me to set another field in the IP header, which is the 3-bit Type of Service (ToS) field. I do not know how this could be done, does anyone here who have done something similar before? I am very grateful for your replies. Thanks! I am using VC.NET under windows.

David
Last edited by LuciWiz : 08-Feb-2006 at 12:40. Reason: Please insert your C++ code between [c++] & [/c++] tags
  #2  
Old 08-Feb-2006, 13:01
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,793
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Setting ToS field in the IP header, socket programming


Quote:
Originally Posted by gaoanyu
Hi friends,

Imy particular application needs me to set another field in the IP header, which is the 3-bit Type of Service (ToS) field.
David


I don't have .NET (or any experience with .NET sockets programming), so I can't answer the question directly.

I suggest that you poke around msdn for the function setsocketopt(), and do some further searching for "Socket Options", specifically the "IP_TOS" socket option. (Note that, for Linux at least, certain parts of the DSCP/ECN fields affected by setsocketopt() may be overwritten by the kernel. Don't know about Windows.)

Regards,

Dave
Last edited by davekw7x : 08-Feb-2006 at 13:52.
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to go for Registry editing and socket programming ? realnapster C++ Forum 2 08-Feb-2006 09:54
Pcap programming in C++ goal86sg C++ Forum 2 25-Jan-2006 15:02
socket programming pointer C++ Forum 1 10-May-2005 16:53
FLTK2 setting input value of an FLTK Input field causes system to crash. Gutty FLTK Forum 0 06-Apr-2005 14:30
write a function in socket programming dxgn C++ Forum 0 07-Jan-2005 09:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 11:24.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.