Project

General

Profile

Bug #8802 » 0001-Improve-socket-extension-docs.patch

deivid (David Rodríguez), 08/19/2013 07:26 AM

View differences:

ext/socket/socket.c
/*
* call-seq:
* socket.connect(remote_sockaddr) => 0
* socket.connect(remote_sockaddr) => 0
*
* Requests a connection to be made on the given +remote_sockaddr+. Returns 0 if
* successful, otherwise an exception is raised.
......
/*
* call-seq:
* socket.connect_nonblock(remote_sockaddr) => 0
* socket.connect_nonblock(remote_sockaddr) => 0
*
* Requests a connection to be made on the given +remote_sockaddr+ after
* O_NONBLOCK is set for the underlying file descriptor.
......
/*
* call-seq:
* socket.bind(local_sockaddr) => 0
* socket.bind(local_sockaddr) => 0
*
* Binds to the given local address.
*
......
/*
* call-seq:
* socket.listen( int ) => 0
* socket.listen( int ) => 0
*
* Listens for connections, using the specified +int+ as the backlog. A call
* to _listen_ only applies if the +socket+ is of type SOCK_STREAM or
......
/*
* call-seq:
* socket.recvfrom(maxlen) => [mesg, sender_addrinfo]
* socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo]
* socket.recvfrom(maxlen) => [mesg, sender_addrinfo]
* socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo]
*
* Receives up to _maxlen_ bytes from +socket+. _flags_ is zero or more
* of the +MSG_+ options. The first element of the results, _mesg_, is the data
......
/*
* call-seq:
* socket.recvfrom_nonblock(maxlen) => [mesg, sender_addrinfo]
* socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_addrinfo]
* socket.recvfrom_nonblock(maxlen) => [mesg, sender_addrinfo]
* socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_addrinfo]
*
* Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
......
/*
* call-seq:
* socket.accept_nonblock => [client_socket, client_addrinfo]
* socket.accept_nonblock => [client_socket, client_addrinfo]
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
......
/*
* call-seq:
* socket.sysaccept => [client_socket_fd, client_addrinfo]
* socket.sysaccept => [client_socket_fd, client_addrinfo]
*
* Accepts an incoming connection returning an array containing the (integer)
* file descriptor for the incoming connection, _client_socket_fd_,
ext/socket/tcpserver.c
/*
* call-seq:
* TCPServer.new([hostname,] port) => tcpserver
* TCPServer.new([hostname,] port) => tcpserver
*
* Creates a new server socket bound to _port_.
*
......
* call-seq:
* tcpserver.accept => tcpsocket
*
* Accepts an incoming connection. It returns a new TCPSocket object.
*
* TCPServer.open("127.0.0.1", 14641) {|serv|
* s = serv.accept
* s.puts Time.now
......
/*
* call-seq:
* tcpserver.accept_nonblock => tcpsocket
* tcpserver.accept_nonblock => tcpsocket
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
ext/socket/udpsocket.c
/*
* call-seq:
* udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
* udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
* udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
* udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
*
* Receives up to _maxlen_ bytes from +udpsocket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
ext/socket/unixserver.c
* call-seq:
* unixserver.accept => unixsocket
*
* Accepts a new connection.
* It returns new UNIXSocket object.
* Accepts an incoming connection.
* It returns a new UNIXSocket object.
*
* UNIXServer.open("/tmp/sock") {|serv|
* UNIXSocket.open("/tmp/sock") {|c|
......
/*
* call-seq:
* unixserver.accept_nonblock => unixsocket
* unixserver.accept_nonblock => unixsocket
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
    (1-1/1)