From: Sam Roberts Date: 2005-01-07T04:12:09+09:00 Subject: Re: Socket.new question Quoteing markusjais@yahoo.de, on Fri, Jan 07, 2005 at 04:01:30AM +0900: > 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 my systems socket manual page: The protocol specifies a particular protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family. However, it is possible that many protocols may exist, in which case a particular protocol must be speci- fied in this manner. The protocol number to use is particular to the communication domain in which communication is to take place; see protocols(5). from /etc/protocols: # See also http://www.isi.edu/in-notes/iana/assignments/protocol-numbers # ip 0 IP # internet protocol, pseudo protocol number #hopopt 0 HOPOPT # hop-by-hop options for ipv6 icmp 1 ICMP # internet control message protocol igmp 2 IGMP # internet group management protocol ggp 3 GGP # gateway-gateway protocol ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') st2 5 ST2 # ST2 datagram mode (RFC 1819) So, 0 means to use IP... which is probably what you want to do! Cheers, Sam