While developing my (BitTorrent based) P2P product, I have stumbled upon a technique that should help shape the network traffic so that the application does not slow down (more than it does by its share of throughput) overall Internet access or jeopardize other network services. It is a well known fact that P2P traffic can be quite heavy and sometimes even bring to its knees network equipment. Thus any effort that could help shape the traffic should be welcomed.

Most of the other BitTorrent based P2P applications decided to use the Type Of Service of the IP header. That seems to work well according to reports from individuals who were capable of using this to regulate their networks so I decided to implement this in my app too. It’s only a single call to set this, once for incoming sockets and once for outgoing.

But nothing is as it seems – the TOS cannot be set by default on all post-Windows NT4 machines. Before anyone starts talking about Microsoft’s secret evil plans, it’s nothing of that sort – turns out Microsoft is following the newer “spec” (I put it in quotes because we are talking about RFCs here) that obsoletes usage of TOS bits. More details can be found in a support article Q248611.

That said, we all know that specs are one thing and reality another. Setting TOS does in fact work on today’s equipment (again, I don’t have hard data but people with no reason to lie are reporting success on several P2P forums) and it would be nice if one could set it.

Not surprisingly, Microsoft does provide a workaround – there is a registry setting that does the trick and it is detailed in the support article I linked above. Note that you must restart your machine before the setting will be effective. Unfortunately, this also means that users of my app will have to do the same.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
0 Comments