U:RDoc::AnyMethod[iI" bind:ETI"Socket#bind;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"&Binds to the given local address.;To:RDoc::Markup::BlankLineS:RDoc::Markup::Heading: leveli: textI"Parameter;To:RDoc::Markup::List: @type: BULLET: @items[o:RDoc::Markup::ListItem: @label0; [o; ; [I"Y+local_sockaddr+ - the +struct+ sockaddr contained in a string or an Addrinfo object;T@S; ; i;I" Example;To:RDoc::Markup::Verbatim; [I"require 'socket' ;TI" ;TI"# use Addrinfo ;TI",socket = Socket.new(:INET, :STREAM, 0) ;TI"2socket.bind(Addrinfo.tcp("127.0.0.1", 2222)) ;TI"@p socket.local_address #=> # ;TI" ;TI"# use struct sockaddr ;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 ) ;T: @format0S; ; i;I"Unix-based Exceptions;To; ; [I"ROn unix-based based systems the following system exceptions may be raised if ;TI"the call to _bind_ fails:;To;;;;[o;;0; [o; ; [I"KErrno::EACCES - the specified _sockaddr_ is protected and the current ;TI"0user does not have permission to bind to it;To;;0; [o; ; [I"CErrno::EADDRINUSE - the specified _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"'the family of the calling +socket+;To;;0; [o; ; [I"KErrno::EBADF - the _sockaddr_ specified is not a valid file descriptor;To;;0; [o; ; [I"?Errno::EFAULT - the _sockaddr_ argument cannot be accessed;To;;0; [o; ; [I"JErrno::EINVAL - the +socket+ is already bound to an address, and the ;TI"Mprotocol does not support binding to the new _sockaddr_ or the +socket+ ;TI"has been shut down.;To;;0; [o; ; [I"NErrno::EINVAL - the address length is not a valid length for the address ;TI" family;To;;0; [o; ; [I"MErrno::ENAMETOOLONG - the pathname resolved had a length which exceeded ;TI" PATH_MAX;To;;0; [o; ; [I"2Errno::ENOBUFS - no buffer space is available;To;;0; [o; ; [I"KErrno::ENOSR - there were insufficient STREAMS resources available to ;TI"complete the operation;To;;0; [o; ; [I">Errno::ENOTSOCK - the +socket+ does not refer to a socket;To;;0; [o; ; [I"JErrno::EOPNOTSUPP - the socket type of the +socket+ does not support ;TI"binding to an address;T@o; ; [I"ROn unix-based based systems if the address family of the calling +socket+ is ;TI"OSocket::AF_UNIX the follow exceptions may be raised if the call to _bind_ ;TI" 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"DErrno::EDESTADDRREQ - the _sockaddr_ argument is a null pointer;To;;0; [o; ; [I"0Errno::EISDIR - same as Errno::EDESTADDRREQ;To;;0; [o; ; [I"'Errno::EIO - an i/o error occurred;To;;0; [o; ; [I"LErrno::ELOOP - too many symbolic links were encountered in translating ;TI"the pathname in _sockaddr_;To;;0; [o; ; [I"HErrno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX ;TI"Ccharacters, or an entire pathname exceeded PATH_MAX characters;To;;0; [o; ; [I"PErrno::ENOENT - a component of the pathname does not name an existing file ;TI"'or the pathname is an empty string;To;;0; [o; ; [I"SErrno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_ ;TI"is not a directory;To;;0; [o; ; [I"CErrno::EROFS - the name would reside on a read only filesystem;T@S; ; i;I"Windows Exceptions;To; ; [I"IOn Windows systems the following system exceptions may be raised if ;TI"the call to _bind_ fails:;To;;;;[ o;;0; [o; ; [I"*Errno::ENETDOWN-- the network is down;To;;0; [o; ; [I"GErrno::EACCES - the attempt to connect the datagram socket to the ;TI"broadcast address failed;To;;0; [o; ; [I"EErrno::EADDRINUSE - the socket's local address is already in use;To;;0; [o; ; [I"RErrno::EADDRNOTAVAIL - the specified address is not a valid address for this ;TI" computer;To;;0; [o; ; [I"OErrno::EFAULT - the socket's internal address or address length parameter ;TI"Dis too small or is not a valid part of the user space addressed;To;;0; [o; ; [I"@Errno::EINVAL - the +socket+ is already bound to an address;To;;0; [o; ; [I"2Errno::ENOBUFS - no buffer space is available;To;;0; [o; ; [I"GErrno::ENOTSOCK - the +socket+ argument does not refer to a socket;T@S; ; i;I"See;To;;;;[o;;0; [o; ; [I",bind manual pages on unix-based systems;To;;0; [o; ; [I"=bind function in Microsoft's Winsock functions reference;T: @fileI"ext/socket/socket.c;T:0@omit_headings_from_table_of_contents_below0I"&socket.bind(local_sockaddr) => 0 ;T0[I" (p1);T@ïFI" Socket;TcRDoc::NormalClass00