[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: how do we use raw sockets?



#include <stdio.h>
#include <sys/types.h>
#include <netinet/ip_icmp.h>
//#include <linux/icmp.h>
#include <asm/poll.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/resource.h>


   struct  sockaddr_in sockaddr;
    T_INT32 lSockid,ulRt_Value;
    T_INT32 flags;
  
    /*
     * Create a socket As Family AF_INET in stream mode
     */
    lSockid = socket(AF_INET,SOCK_RAW,IPPROTO_ICMP);
    if(lSockid == -1)
    {
       perror("Create Socket():Socket creation failed ");
       return(-1);
    }
This one example how to use raw sockets. This will help You
From
Ch.Rama Krishna Prasad.




On Fri, 02 Feb 2001, adubey@xxxxxxxxxxx wrote:
> Hi 
> i ran this quey a long time ack.. does anyone here know how to use raw
> sockets?
> 
> i am working on solaris.. but i guess it cant be very different.. 
> 
> there is no way i could find any docs on the same.. 
> 
> Alok
> 
> 
> ---------------------------------------------
> LIP is all for free speech.  But it was created
> for a purpose.  Violations of the rules of
> this list will result in stern action.