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