On Fri, 2005-01-07 at 04:01 +0900, Markus Jais wrote:
> hello
> 
> I can create a socket object like this:
> 
>  Socket.new(Socket::PF_INET, Socket::SOCK_STREAM, 0)
> 
> but what exactly is the third parameter ??
> according to the Pickaxe this parameter is called "protocol".
> 
> what can I specify as a third parameter instead of 0 and do I need this 
> sometimes ??

>From 'man 7 ip' on my Linux box:

"An   IP  socket  is  created  by  calling  the  socket(2)  function  as
socket(PF_INET,  socket_type,  protocol).   Valid  socket   types   are
SOCK_STREAM  to  open  a  tcp(7)  socket,  SOCK_DGRAM  to open a udp(7)
socket, or SOCK_RAW to open a raw(7) socket to access the  IP  protocol
directly.   protocol is the IP protocol in the IP header to be received
or sent.  The only valid values for protocol are 0 and IPPROTO_TCP  for
TCP  sockets  and  0 and IPPROTO_UDP for UDP sockets.  For SOCK_RAW you
may specify a valid IANA IP protocol defined in RFC1700  assigned  num-
bers."

So basically, in most usual case (IP and TCP/UDP), specifying the third
parameter is redundant.

You can get the official list of the defined protocol from
http://www.iana.org/assignments/protocol-numbers or from /etc/protocols
on a UNIX machine (not sure where it is on a Windows box).

Hope it helps,
Guillaume.

> thanks in advance !
> 
> regards
> 
> Markus
> 
>