U:RDoc::AnyMethod[iI" connect:ETI"Socket#connect;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"SRequests a connection to be made on the given +remote_sockaddr+. Returns 0 if ;TI"2successful, otherwise an exception is raised.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameter;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"W+remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object;T@S; ; i;I" Example:;To:RDoc::Markup::Verbatim; [ I"## Pull down Google's web page ;TI"require 'socket' ;TI"include Socket::Constants ;TI"4socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) ;TI"@sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' ) ;TI" socket.connect( sockaddr ) ;TI".socket.write( "GET / HTTP/1.0\r\n\r\n" ) ;TI"results = socket.read ;T: @format0S; ; i;I"Unix-based Exceptions;To; ; [I"LOn unix-based systems the following system exceptions may be raised if ;TI"!the call to _connect_ fails:;To;;;;[o;;0; [o; ; [I"OErrno::EACCES - search permission is denied for a component of the prefix ;TI"3path or write access to the +socket+ is denied;To;;0; [o; ; [I"9Errno::EADDRINUSE - the _sockaddr_ is already in use;To;;0; [o; ; [I"OErrno::EADDRNOTAVAIL - the specified _sockaddr_ is not available from the ;TI"local machine;To;;0; [o; ; [I"OErrno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for ;TI"1the address family of the specified +socket+;To;;0; [o; ; [I"MErrno::EALREADY - a connection is already in progress for the specified ;TI" socket;To;;0; [o; ; [I"?Errno::EBADF - the +socket+ is not a valid file descriptor;To;;0; [o; ; [I"SErrno::ECONNREFUSED - the target _sockaddr_ was not listening for connections ;TI"#refused the connection request;To;;0; [o; ; [I"EErrno::ECONNRESET - the remote host reset the connection request;To;;0; [o; ; [I"6Errno::EFAULT - the _sockaddr_ cannot be accessed;To;;0; [o; ; [I"LErrno::EHOSTUNREACH - the destination host cannot be reached (probably ;TI"Abecause the host is down or a remote router cannot reach it);To;;0; [o; ; [I"IErrno::EINPROGRESS - the O_NONBLOCK is set for the +socket+ and the ;TI"Jconnection cannot be immediately established; the connection will be ;TI"established asynchronously;To;;0; [o; ; [I"OErrno::EINTR - the attempt to establish the connection was interrupted by ;TI"Ndelivery of a signal that was caught; the connection will be established ;TI"asynchronously;To;;0; [o; ; [I"AErrno::EISCONN - the specified +socket+ is already connected;To;;0; [o; ; [I"OErrno::EINVAL - the address length used for the _sockaddr_ is not a valid ;TI"Nlength for the address family or there is an invalid family in _sockaddr_;To;;0; [o; ; [I"MErrno::ENAMETOOLONG - the pathname resolved had a length which exceeded ;TI" PATH_MAX;To;;0; [o; ; [I"PErrno::ENETDOWN - the local interface used to reach the destination is down;To;;0; [o; ; [I" 0 ;T0[I" (p1);T@HFI" Socket;TcRDoc::NormalClass00