%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/cpanel/ea-ruby24/root/usr/share/ri/system/Socket/
Upload File :
Create Path :
Current File : //opt/cpanel/ea-ruby24/root/usr/share/ri/system/Socket/tcp_server_loop-c.ri

U:RDoc::AnyMethod[iI"tcp_server_loop:EFI"Socket::tcp_server_loop;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I"Ycreates a TCP/IP server on _port_ and calls the block for each connection accepted. ;TI"RThe block is called with a socket and a client_address as an Addrinfo object.;To:RDoc::Markup::BlankLineo;
;	[I"VIf _host_ is specified, it is used with _port_ to determine the server addresses.;T@o;
;	[I"8The socket is *not* closed when the block returns. ;TI"/So application should close it explicitly.;T@o;
;	[I"/This method calls the block sequentially. ;TI"PIt means that the next connection is not accepted until the block returns. ;TI"gSo concurrent mechanism, thread for example, should be used to service multiple clients at a time.;T@o;
;	[
I"VNote that Addrinfo.getaddrinfo is used to determine the server socket addresses. ;TI">When Addrinfo.getaddrinfo returns two or more addresses, ;TI"(IPv4 and IPv6 address for example, ;TI"all of them are used. ;TI"HSocket.tcp_server_loop succeeds if one socket can be used at least.;T@o:RDoc::Markup::Verbatim;	[I"# Sequential echo server.
;TI".# It services only one client at a time.
;TI"<Socket.tcp_server_loop(16807) {|sock, client_addrinfo|
;TI"
  begin
;TI"$    IO.copy_stream(sock, sock)
;TI"  ensure
;TI"    sock.close
;TI"  end
;TI"}
;TI"
;TI"# Threaded echo server
;TI"/# It services multiple clients at a time.
;TI"5# Note that it may accept connections too much.
;TI"<Socket.tcp_server_loop(16807) {|sock, client_addrinfo|
;TI"  Thread.new {
;TI"    begin
;TI"&      IO.copy_stream(sock, sock)
;TI"    ensure
;TI"      sock.close
;TI"
    end
;TI"	  }
;TI"};T:@format0:
@fileI"ext/socket/lib/socket.rb;T:0@omit_headings_from_table_of_contents_below00I"socket, client_addrinfo;F[I"(host=nil, port);T@;FI"Socket;TcRDoc::NormalClass00

Zerion Mini Shell 1.0