[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] raw sockets on XP

From: root
Subject: [Axiom-developer] raw sockets on XP
Date: Tue, 2 Oct 2007 17:28:07 -0400

I've been looking into the raw socket programming issue for gcl and found:


      How Microsoft restricts developers on networking

Nowadays I'm interested in raw network programming which gives you 
ability to construct you building custom headers and makes sure that OS 
kernel does not modify these headers. I've started a VS.NET C++ console 
application (unmanaged) and typed several lines to test.

    #include "stdafx.h"

    int _tmain(int argc, _TCHAR* argv[])
    SOCKET s;
    int optval = 1;

    s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
    setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *)&optval, sizeof optval);

    return 0;

I got an error message;

    Error 1 error C2065: 'IP_HDRINCL' : undeclared identifier ..

After some quick research I've come up to this solution. If you are 
interested in low level networking like me, you should have Unix based 
boxes instead of Microsoft. The reason is simple; restrictions. Raw 
socket programming is available in all Unix, and Linux OSs on the other 
hand MS based OSs is restricted to NT based ones. None of Windows 95, 
98, 98SE supported raw sockets. It becames available on Windows from 
Windows 2000, Windows XP but with Windows XP SP2 this feature is 
disabled. Quick summary from Microsoft's specification 
<> for this issue:

    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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]