Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Raw Sockets

by tadman (Prior)
on Mar 19, 2002 at 17:35 UTC ( [id://152795]=note: print w/replies, xml ) Need Help??


in reply to Raw Sockets

SOCK_RAW is the right idea. You can even use IO::Socket if you're into that sort of thing, as it's a lot easier than using straight POSIX-type socket calls. Either way, you're going to need to do something like this:
my $rv = socket ($s, AF_INET, SOCK_RAW, IPPROTO_RAW);

To make a raw socket, you have to be "root" or equivalent. Not sure how this works on NT, but perhaps you have to be the Administrator. Since you are creating the socket successfully, this doesn't seem to be a problem.

What I think your problem is likely to be is the use of syswrite where you should be using sendto. You can use something like syswrite if your socket is connected. A RAW socket is not. Don't assume that the kernel is going to open up your packet and see what you mean.

So, this way you can treat the socket like any old socket, except that you have to make the headers yourself and send it like a regular UDP-type packet (connectionless).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://152795]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-26 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found