Solved

setsockopt: Type Of Service - How?

Posted on 1998-10-29
7
526 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now