Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

setsockopt: Type Of Service - How?

Posted on 1998-10-29
7
Medium Priority
?
597 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 440 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

688 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