Solved

setsockopt: Type Of Service - How?

Posted on 1998-10-29
7
549 Views
Last Modified: 2013-11-20
I am trying to set the Type of Service socket options in a Visual C++ 5.0 (MFC) program. I am utilizing WinNT 4.0, winsock 1.1 and the CSocket class. I am particularly interested in setting the Precedence of the message. Can this be done? Can this be done with winsock 2? Thanks.
0
Comment
Question by:j99
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:sudhirbrat
ID: 1323984
In the function CSocket::Send( const void* lpBuf, int nBufLen, int nFlags = 0 );, u can use a flag MSG_OOB(Send out-of-band data ). But it works only for stream sockets. This option is generally used to send urgent data.
                            or
In the SetSockOpt() function u can Disable the Nagle algorithm for send with flag TCP_NODELAY. This will increase the performance, but has negative impact on network performance.


0
 

Author Comment

by:j99
ID: 1323985
Thank you for your interest in this question. I realize now that I should have been more specific. I'm specifically curious whether or not this works:

setsockopt(aSocket, IPPROTO_IP, IP_TOS,
           (const char FAR *)&tos, len);

where you are setting the precedence level. The sources I've looked at are consistent in saying that WinSock 1.1 does not provide access to the TOS field in the IP header; however, it's not clear whether or not WinSock 2.0 will really let you set this or not.
0
 

Accepted Solution

by:
zingo earned 220 total points
ID: 1323986
Yes, this can be done in WinSock 2 but not in 1.1. You are quite right. Was that worth 220 points?
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:j99
ID: 1323987
I've looked high and low for documentation on this question. The documentation that I encountered "seems to indicate," as you suggest, that one may set this value using WinSock 2 and not 1.1. Of particular concern is whether or not Microsoft's specific implementation will allow this. Since much of the existing software at this shop is dependent on WinSock 1.1 calls, changing to WinSock 2 is highly problematic. Given all that, I'm happy to pay well for hard knowledge and experience with this question (which I'm assuming you have) before I go shooting my mouth off to management, customers, etc. Thank you for your interest in this question.
0
 

Expert Comment

by:zingo
ID: 1323988
Hmm, since you said you were going to shout at the management, I thought that I should look into it in more detail. And guess what I found? In winsock.h for WinSock 1.1, there is a definition "#define IP_TOS              8           /* set/get IP Type Of Service       */".
But there is no documentation on how to use it, so I assume that 0 is low prio and 7 is high. Feel free to try it out. I cant see why they havent documented this, but one reason could be that it is not implemented yet. So if I were you, I would verify it using an Ethernet analyzer. I hope you haven't done any shouting yet.

0
 

Author Comment

by:j99
ID: 1323989
Yep, utilizing IP_TOS does not work in 1.1. But does it work in WinSock 2?
0
 

Expert Comment

by:zingo
ID: 1323990
Tricky question. I have not used it myself, but I have been told it should work in version 2. My source on this is involved in IP telephony development, so I really hope that he knows what he is talking about.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 118
move a line in eclipse 3 103
child constructor and parent constructor, overriding and overloading 6 85
x-bar in Google Sheets 2 55
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question