2009年1月4日星期日

socket 之 SOCK_RAW

Sniffer、ping使用这种方式

socket( )

NAME

socket( ) - open a socket

SYNOPSIS

int socket

(

int domain, /* address family (AF_xxx) */

int type, /* socket type (SOCK_xxx) */

int protocol /* socket protocol (usually 0) */

)

DESCRIPTION

This routine opens a socket and returns a socket descriptor. The socket descriptor is passed to the other socket routines to identify the socket. The socket descriptor is a standard I/O system file descriptor (fd) and can be used with the close( ), read( ), write( ), and ioctl( ) routines.

Available socket types include:

SOCK_STREAM

Specifies a connection-based (stream) socket.

SOCK_DGRAM

Specifies a datagram (UDP) socket.

SOCK_RAW

Specifies a raw socket.

SOCK_SEQPACKET

Specifies a connected, sequential packets socket (COMP).

0 评论: