U:RDoc::AnyMethod[iI" listen:ETI"Socket#listen;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"OListens for connections, using the specified +int+ as the backlog. A call ;TI"Hto _listen_ only applies if the +socket+ is of type SOCK_STREAM or ;TI"SOCK_SEQPACKET.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameter;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"I+backlog+ - the maximum length of the queue for pending connections.;T@S; ; i;I"Example 1;To:RDoc::Markup::Verbatim; [ I"require 'socket' ;TI"include Socket::Constants ;TI"4socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) ;TI"=sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' ) ;TI"socket.bind( sockaddr ) ;TI"socket.listen( 5 ) ;T: @format0S; ; i;I"IExample 2 (listening on an arbitrary port, unix-based systems only):;To;; [ I"require 'socket' ;TI"include Socket::Constants ;TI"4socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) ;TI"socket.listen( 1 ) ;T;0S; ; i;I"Unix-based Exceptions;To; ; [ I"OOn unix based systems the above will work because a new +sockaddr+ struct ;TI"Pis created on the address ADDR_ANY, for an arbitrary port number as handed ;TI"Soff by the kernel. It will not work on Windows, because Windows requires that ;TI"Dthe +socket+ is bound by calling _bind_ before it can _listen_.;T@o; ; [I"JIf the _backlog_ amount exceeds the implementation-dependent maximum ;TI"Jqueue length, the implementation's maximum queue length will be used.;T@o; ; [I"VOn unix-based based systems the following system exceptions may be raised if the ;TI"call to _listen_ fails:;To;;;;[ o;;0; [o; ; [I"HErrno::EBADF - the _socket_ argument is not a valid file descriptor;To;;0; [o; ; [I"MErrno::EDESTADDRREQ - the _socket_ is not bound to a local address, and ;TI"Athe protocol does not support listening on an unbound socket;To;;0; [o; ; [I"6Errno::EINVAL - the _socket_ is already connected;To;;0; [o; ; [I"GErrno::ENOTSOCK - the _socket_ argument does not refer to a socket;To;;0; [o; ; [I"FErrno::EOPNOTSUPP - the _socket_ protocol does not support listen;To;;0; [o; ; [I"MErrno::EACCES - the calling process does not have appropriate privileges;To;;0; [o; ; [I"4Errno::EINVAL - the _socket_ has been shut down;To;;0; [o; ; [I"LErrno::ENOBUFS - insufficient resources are available in the system to ;TI"complete the call;T@S; ; i;I"Windows Exceptions;To; ; [I"IOn Windows systems the following system exceptions may be raised if ;TI" the call to _listen_ fails:;To;;;;[o;;0; [o; ; [I"*Errno::ENETDOWN - the network is down;To;;0; [o; ; [ I"LErrno::EADDRINUSE - the socket's local address is already in use. This ;TI"Husually occurs during the execution of _bind_ but could be delayed ;TI"Jif the call to _bind_ was to a partially wildcard address (involving ;TI"FADDR_ANY) and if a specific address needs to be committed at the ;TI"!time of the call to _listen_;To;;0; [o; ; [I"KErrno::EINPROGRESS - a Windows Sockets 1.1 call is in progress or the ;TI"=service provider is still processing a callback function;To;;0; [o; ; [I"KErrno::EINVAL - the +socket+ has not been bound with a call to _bind_.;To;;0; [o; ; [I"7Errno::EISCONN - the +socket+ is already connected;To;;0; [o; ; [I"=Errno::EMFILE - no more socket descriptors are available;To;;0; [o; ; [I"2Errno::ENOBUFS - no buffer space is available;To;;0; [o; ; [I".Errno::ENOTSOC - +socket+ is not a socket;To;;0; [o; ; [I"MErrno::EOPNOTSUPP - the referenced +socket+ is not a type that supports ;TI"the _listen_ method;T@S; ; i;I"See;To;;;;[o;;0; [o; ; [I".listen manual pages on unix-based systems;To;;0; [o; ; [I"?listen function in Microsoft's Winsock functions reference;T: @fileI"ext/socket/socket.c;T:0@omit_headings_from_table_of_contents_below0I"socket.listen( int ) => 0 ;T0[I" (p1);T@¬FI" Socket;TcRDoc::NormalClass00