How to do raw Ethernet under Win32?

Leopold Faschalek fale.delete at remove.skidata.com
Thu Jul 24 06:39:27 EDT 2003


"Grant Edwards" <grante at visi.com> wrote in message
news:3f1ed31a$0$181$a1866201 at newsreader.visi.com...
> How does one do raw Ethernet under Win32?  Ultimately, I want
> to do it in a Python program, but if somebody can point me to a
> clue on how to do it from C, I could probably figure out the
> rest.
>
> I want to:
>
>  1) Send an arbitrary Ethernet packet.  [Well, not completely
>     arbitrary, the source MAC will be "right", but the protocol
>     number is a proprietary (not IP) one, and the packet isn't
>     anything standard.
>
>  2) Receive any incoming packets with a specified protocl
>     number -- same proto number as in 1) above.
>
> I've got a program that works under Linux, and I'd like to be
> able to port it to Win32...
>

the new winsock2.h supports more socket types:
/*
 * Types
 */
#define SOCK_STREAM     1               /* stream socket */
#define SOCK_DGRAM      2               /* datagram socket */
#define SOCK_RAW        3               /* raw-protocol interface */
#define SOCK_RDM        4               /* reliably-delivered message */
#define SOCK_SEQPACKET  5               /* sequenced packet stream */

so you have only to define 3 as type in the socket() call

greetings
Leopold Faschalek

> --
> Grant Edwards                   grante             Yow!  I have seen these
>                                   at               EGG EXTENDERS in my
>                                visi.com            Supermarket... I have
read
>                                                    theINSTRUCTIONS...






More information about the Python-list mailing list