Jump to content
  • Advertisement
Sign in to follow this  
Roel Van Nyen

Raw Sockets and SP2

This topic is 4835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been programming in winsock and supporting the windows platform. Recently i learned about the advantages of writing youre own protocol using raw sockets in winsock. So i began to read about it and after i while i found an article.. : "http://www.interact-sw.co.uk/iangblog/2004/08/12/norawsockets" . The article explains the fact that xp no longer supports raw sockets if you install SP2 except if you are admin. Does anybody know a way to fix this ? (And i know it does work on linux, freebsd etc ...) Greetz Roel Van Nyen

Share this post


Link to post
Share on other sites
Advertisement
What "advantages" would those be?

Unless you count total inability to work through most residential gateways and firewalls an "advantage," perhaps?

Anyway, to get the full raw sockets ability, you need to write some kind of kernel-level device driver to get at the card at a low level. Probably the easiest would be some kind of protocol driver. OSR has good classes on Windows kernel-level programming in various contexts.

Share this post


Link to post
Share on other sites
Is it realy a big problem to get through the gateways and firewalls if you include the IP header ? (no tcp/upd or other protocol)
Well i would use it to reduce overhead that i would get when using tcp.
Is there another way to reduce overhead apart from sending batches instead of lots of packages ?

Greetz
Roel Van Nyen

Share this post


Link to post
Share on other sites
Quote:
Original post by Roel Van Nyen
The article explains the fact that xp no longer supports raw sockets if you install SP2 except if you are admin.

That's not entirely accurate.
http://blogs.msdn.com/michael_howard/archive/2004/08/12/213611.aspx
I find this little quote of particular interest.
Quote:
The Windows implementation of TCP/IP still supports receiving traffic on raw IP sockets. However, the ability to send traffic over raw sockets has been restricted in two ways:

* TCP data cannot be sent over raw sockets.
* UDP datagrams with invalid source addresses cannot be sent over raw sockets. The IP source address for any outgoing UDP datagram must exist on a network interface or the datagram is dropped.

Share this post


Link to post
Share on other sites
Quote:
Is it realy a big problem to get through the gateways and firewalls if you include the IP header


Many routers/firewalls will just drop an incoming packet that uses a protocol field it doesn't recognize (i e, not ICMP/UDP/TCP). Even if they didn't, NAT works by knowing the internal/external mapping of address PLUS PORT, and any residential gateway that does NAT (which is all of them) would not be able to translate your protocol.

Before you think that TCP/UDP has "lots of overhead," you should consider that the skilled professionals that designed these protocols over many years were also very concerned about bandwidth usage. Network pipes in the '80s were not what we have today -- a 56 kilobit fixed connection was considered "high throughput" and 1.5 megabit was almost unheard-of.

If you want to reduce header overhead on a TCP connection, the best thing to do is to set a fixed send rate (say, 10 times a second), and buffer your outgoing data. Every send tick, you send all the queued data in one gulp; this will typically generate a single outgoing TCP packet. In fact, it's almost guaranteed to if you turn on TCP_NODELAY, which you should if you're an interactive application.

Share this post


Link to post
Share on other sites
I was also interested in learning how to use those "raw sockets" but coudln't find no MSDN article about it. Could anyone give me a link or the API that uses them?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!