Raw Sockets

dominic.j.steinitz@britishairways.com dominic.j.steinitz@britishairways.com
Wed, 6 Mar 2002 09:04:26 +0000


Thanks. On Linux I get

[dom@lhrtba8fd85 ping]$ test5
Protocol name: icmp
Protocol aliases: ["ICMP"]
Protocol number: 1

Fail: permission denied
Action: socket
Reason: privileged operation

as expected but on W98 I get

Protocol name: icmp
Protocol aliases: ["ICMP"]
Protocol number: 1398538241

Fail: failed
Action: socket
Reason: No error

I would have expected success. I haven't got access to C tools so I can't
see if I would get the same if I used the C sockets API.


"Simon Marlow" <simonmar@microsoft.com>@haskell.org on 04/03/2002 16:24:44

Sent by:  glasgow-haskell-users-admin@haskell.org

To:   <dominic.j.steinitz
cc:   <glasgow-haskell-users
Subject:  RE: Raw Sockets

> It looks like you want SOCK_RAW, not AF_RAW.  GHC does support this,
> with the 'Raw' socket type, something like this:
>       proto <- getProtocolByName "icmp"
>    s <- socket AF_INT Raw proto

should be:

     s <- socket AF_INET Raw (protoNumber proto)

and of course you have to be root to send raw packets to the network.

Glasgow-haskell-users mailing list


      Save time by using an eTicket and our Self-Service Check-in Kiosks.
      For more information go to http://www.britishairways.com/eservice1