summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-22 08:04:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-22 08:04:13 +0000
commit977267c2e0218d6b182807ddf9b7c1d929c40bed (patch)
tree815b002eaefef951ce56a1d58bca375c62bd7350 /ext/socket
parent36f8540a2b024ee30092ea6a0eebfa40ccc95b07 (diff)
* ext/**/*.[ch]: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/addrinfo.h4
-rw-r--r--ext/socket/ancdata.c24
-rw-r--r--ext/socket/basicsocket.c22
-rw-r--r--ext/socket/getaddrinfo.c10
-rw-r--r--ext/socket/getnameinfo.c4
-rw-r--r--ext/socket/ipsocket.c10
-rw-r--r--ext/socket/option.c6
-rw-r--r--ext/socket/raddrinfo.c14
-rw-r--r--ext/socket/socket.c226
-rw-r--r--ext/socket/tcpserver.c16
-rw-r--r--ext/socket/udpsocket.c12
-rw-r--r--ext/socket/unixserver.c12
-rw-r--r--ext/socket/unixsocket.c8
13 files changed, 184 insertions, 184 deletions
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
index 806b00e..f0b977d 100644
--- a/ext/socket/addrinfo.h
+++ b/ext/socket/addrinfo.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index a1d1219..a42aea7 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -65,7 +65,7 @@ ip_cmsg_type_to_sym(int level, int cmsg_type)
* p Socket::AncillaryData.new(:INET, :TCP, :NODELAY, "")
* #=> #<Socket::AncillaryData: INET TCP NODELAY "">
*
- * p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
+ * p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
* #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO "">
*
*/
@@ -228,7 +228,7 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
*
* returns the array of IO objects for SCM_RIGHTS control message in UNIX domain socket.
*
- * The class of the IO objects in the array is IO or Socket.
+ * The class of the IO objects in the array is IO or Socket.
*
* The array is attached to _ancillarydata_ when it is instantiated.
* For example, BasicSocket#recvmsg attach the array when
@@ -356,7 +356,7 @@ ancillary_timestamp(VALUE self)
*
* Creates a new Socket::AncillaryData object which contains a int as data.
*
- * The size and endian is dependent on the host.
+ * The size and endian is dependent on the host.
*
* p Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
* #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 2>
@@ -377,7 +377,7 @@ ancillary_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE vtype, VALUE int
*
* Returns the data in _ancillarydata_ as an int.
*
- * The size and endian is dependent on the host.
+ * The size and endian is dependent on the host.
*
* ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
* p ancdata.int #=> 2
@@ -592,7 +592,7 @@ extract_ipv6_pktinfo(VALUE self, struct in6_pktinfo *pktinfo_ptr, struct sockadd
*
* IPV6_PKTINFO is defined by RFC 3542.
*
- * addr = Addrinfo.ip("::1")
+ * addr = Addrinfo.ip("::1")
* ifindex = 0
* ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
* p ancdata.ipv6_pktinfo #=> [#<Addrinfo: ::1>, 0]
@@ -778,7 +778,7 @@ anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret)
{
if (level == IPPROTO_IP && type == IP_RECVDSTADDR &&
RSTRING_LEN(data) == sizeof(struct in_addr)) {
- struct in_addr addr;
+ struct in_addr addr;
char addrbuf[INET_ADDRSTRLEN];
memcpy(&addr, RSTRING_PTR(data), sizeof(addr));
if (inet_ntop(AF_INET, &addr, addrbuf, sizeof(addrbuf)) == NULL)
@@ -829,7 +829,7 @@ anc_inspect_ipv6_pktinfo(int level, int type, VALUE data, VALUE ret)
if (level == IPPROTO_IPV6 && type == IPV6_PKTINFO &&
RSTRING_LEN(data) == sizeof(struct in6_pktinfo)) {
struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)RSTRING_PTR(data);
- struct in6_addr addr;
+ struct in6_addr addr;
unsigned int ifindex;
char addrbuf[INET6_ADDRSTRLEN], ifbuf[IFNAMSIZ];
memcpy(&addr, &pktinfo->ipi6_addr, sizeof(addr));
@@ -1033,7 +1033,7 @@ ancillary_inspect(VALUE self)
# endif
}
break;
-
+
case AF_INET:
#ifdef INET6
case AF_INET6:
@@ -1211,18 +1211,18 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (last_pad) {
/*
* This code removes the last padding from msg_controllen.
- *
+ *
* 4.3BSD-Reno reject the padding for SCM_RIGHTS. (There was no 64bit environments in those days?)
* RFC 2292 require the padding.
* RFC 3542 relaxes the condition - implementation must accept both as valid.
- *
+ *
* Actual problems:
*
* - NetBSD 4.0.1
* SCM_RIGHTS with padding causes EINVAL
* IPV6_PKTINFO without padding causes "page fault trap"
* http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40661
- *
+ *
* - OpenBSD 4.4
* IPV6_PKTINFO without padding causes EINVAL
*
@@ -1317,7 +1317,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
* sendmsg can be used to implement send_io as follows:
*
* # use Socket::AncillaryData.
- * ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno)
+ * ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, io.fileno)
* sock.sendmsg("a", 0, nil, ancdata)
*
* # use 3-element array.
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index a4c42ee..0316f99 100644
--- a/ext/socket/basicsocket.c
+++ b/ext/socket/basicsocket.c
@@ -57,7 +57,7 @@ bsock_s_for_fd(VALUE klass, VALUE fd)
* s2.close
* p s1.read #=> "pong\n"
* }
- *
+ *
*/
static VALUE
bsock_shutdown(int argc, VALUE *argv, VALUE sock)
@@ -179,15 +179,15 @@ bsock_close_write(VALUE sock)
*
* Some socket options are integers with boolean values, in this case
* #setsockopt could be called like this:
- * sock.setsockopt(:SOCKET, :REUSEADDR, true)
+ * sock.setsockopt(:SOCKET, :REUSEADDR, true)
* sock.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
* sock.setsockopt(Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true))
*
* Some socket options are integers with numeric values, in this case
* #setsockopt could be called like this:
- * sock.setsockopt(:IP, :TTL, 255)
+ * sock.setsockopt(:IP, :TTL, 255)
* sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_TTL, 255)
- * sock.setsockopt(Socket::Option.int(:INET, :IP, :TTL, 255))
+ * sock.setsockopt(Socket::Option.int(:INET, :IP, :TTL, 255))
*
* Option values may be structs. Passing them can be complex as it involves
* examining your system headers to determine the correct definition. An
@@ -196,7 +196,7 @@ bsock_close_write(VALUE sock)
* struct in_addr imr_multiaddr;
* struct in_addr imr_interface;
* };
- *
+ *
* In this case #setsockopt could be called like this:
* optval = IPAddr.new("224.0.0.251").hton +
* IPAddr.new(Socket::INADDR_ANY, Socket::AF_INET).hton
@@ -303,7 +303,7 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
* int l_onoff;
* int l_linger;
* };
- *
+ *
* In this case #getsockopt could be called like this:
*
* # Socket::Option knows linger structure.
@@ -647,7 +647,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* call-seq:
* basicsocket.recv_nonblock(maxlen) => mesg
* basicsocket.recv_nonblock(maxlen, flags) => mesg
- *
+ *
* Receives up to _maxlen_ bytes from +socket+ using recvfrom(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* _flags_ is zero or more of the +MSG_+ options.
@@ -656,11 +656,11 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* When recvfrom(2) returns 0, Socket#recv_nonblock returns
* an empty string as data.
* The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
- *
+ *
* === Parameters
* * +maxlen+ - the number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
* === Example
* serv = TCPServer.new("127.0.0.1", 0)
* af, port, host, addr = serv.addr
@@ -675,7 +675,7 @@ bsock_recv(int argc, VALUE *argv, VALUE sock)
* end
*
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- * to _recv_nonblock_ fails.
+ * to _recv_nonblock_ fails.
*
* BasicSocket#recv_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index d5ef517..a4f01c0 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -45,7 +45,7 @@
#include <sys/types.h>
#ifndef _WIN32
#include <sys/param.h>
-#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
+#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
# include <net/socket.h>
#else
# include <sys/socket.h>
@@ -97,7 +97,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 };
static const char in6_addrany[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-static const char in_loopback[] = { 127, 0, 0, 1 };
+static const char in_loopback[] = { 127, 0, 0, 1 };
static const char in6_loopback[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
@@ -502,7 +502,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
*/
get_name(pton, &afdl[i], &top, pton, pai, port);
goto good;
- } else
+ } else
ERR(EAI_FAMILY); /*xxx*/
}
}
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index 7f090e9..fca3bcf 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index b6b2426..68ff5a1 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -159,10 +159,10 @@ rsock_revlookup_flag(VALUE revlookup, int *norevlookup)
/*
* call-seq:
- * ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
+ * ipsocket.addr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
*
* Returns the local address as an array which contains
- * address_family, port, hostname and numeric_address.
+ * address_family, port, hostname and numeric_address.
*
* If +reverse_lookup+ is +true+ or +:hostname+,
* hostname is obtained from numeric_address using reverse lookup.
@@ -199,10 +199,10 @@ ip_addr(int argc, VALUE *argv, VALUE sock)
/*
* call-seq:
- * ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
+ * ipsocket.peeraddr([reverse_lookup]) => [address_family, port, hostname, numeric_address]
*
* Returns the remote address as an array which contains
- * address_family, port, hostname and numeric_address.
+ * address_family, port, hostname and numeric_address.
* It is defined for connection oriented socket such as TCPSocket.
*
* If +reverse_lookup+ is +true+ or +:hostname+,
@@ -257,7 +257,7 @@ ip_peeraddr(int argc, VALUE *argv, VALUE sock)
* u2 = UDPSocket.new
* u2.send "uuuu", 0, "127.0.0.1", 4913
* p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", "127.0.0.1"]]
- *
+ *
*/
static VALUE
ip_recvfrom(int argc, VALUE *argv, VALUE sock)
diff --git a/ext/socket/option.c b/ext/socket/option.c
index dde8b41..23afbe2 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -148,7 +148,7 @@ sockopt_data(VALUE self)
*
* Creates a new Socket::Option object which contains an int as data.
*
- * The size and endian is dependent on the platform.
+ * The size and endian is dependent on the platform.
*
* p Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1)
* #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
@@ -169,7 +169,7 @@ sockopt_s_int(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vi
*
* Returns the data in _sockopt_ as an int.
*
- * The size and endian is dependent on the platform.
+ * The size and endian is dependent on the platform.
*
* sockopt = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 1)
* p sockopt.int => 1
@@ -280,7 +280,7 @@ sockopt_linger(VALUE self)
VALUE vonoff, vsecs;
if (level != SOL_SOCKET || optname != SO_LINGER)
- rb_raise(rb_eTypeError, "linger socket option expected");
+ rb_raise(rb_eTypeError, "linger socket option expected");
if (RSTRING_LEN(data) != sizeof(l))
rb_raise(rb_eTypeError, "size differ. expected as sizeof(struct linger)=%d but %ld",
(int)sizeof(struct linger), (long)RSTRING_LEN(data));
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index b035f2e..8f89240 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -743,7 +743,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
un.sun_family = AF_UNIX;
memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
-
+
init_addrinfo(rai, (struct sockaddr *)&un, sizeof(un), PF_UNIX, socktype, 0, Qnil, Qnil);
}
#endif
@@ -766,9 +766,9 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
* Socket.sockaddr_in or Socket.unpack_sockaddr_un.
*
* sockaddr examples:
- * - ["AF_INET", 46102, "localhost.localdomain", "127.0.0.1"]
- * - ["AF_INET6", 42304, "ip6-localhost", "::1"]
- * - ["AF_UNIX", "/tmp/sock"]
+ * - ["AF_INET", 46102, "localhost.localdomain", "127.0.0.1"]
+ * - ["AF_INET6", 42304, "ip6-localhost", "::1"]
+ * - ["AF_UNIX", "/tmp/sock"]
* - Socket.sockaddr_in("smtp", "2001:DB8::1")
* - Socket.sockaddr_in(80, "172.18.22.42")
* - Socket.sockaddr_in(80, "www.ruby-lang.org")
@@ -1374,7 +1374,7 @@ addrinfo_protocol(VALUE self)
*
* returns the socket address as packed struct sockaddr string.
*
- * Addrinfo.tcp("localhost", 80).to_sockaddr
+ * Addrinfo.tcp("localhost", 80).to_sockaddr
* #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
*
*/
@@ -1928,11 +1928,11 @@ addrinfo_unix_path(VALUE self)
* nodename or service can be nil if no conversion intended.
*
* family, socktype and protocol are hint for preferred protocol.
- * If the result will be used for a socket with SOCK_STREAM,
+ * If the result will be used for a socket with SOCK_STREAM,
* SOCK_STREAM should be specified as socktype.
* If so, Addrinfo.getaddrinfo returns addrinfo list appropriate for SOCK_STREAM.
* If they are omitted or nil is given, the result is not restricted.
- *
+ *
* Similarly, PF_INET6 as family restricts for IPv6.
*
* flags should be bitwise OR of Socket::AI_??? constants.
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 204f81a..1c499d9 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -135,13 +135,13 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* 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.
- *
+ *
* === Parameter
* * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
- *
+ *
* === Example:
* # Pull down Google's web page
* require 'socket'
@@ -150,17 +150,17 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
* socket.connect( sockaddr )
* socket.write( "GET / HTTP/1.0\r\n\r\n" )
- * results = socket.read
- *
+ * results = socket.read
+ *
* === Unix-based Exceptions
- * On unix-based systems the following system exceptions may be raised if
+ * On unix-based systems the following system exceptions may be raised if
* the call to _connect_ fails:
* * Errno::EACCES - search permission is denied for a component of the prefix
* path or write access to the +socket+ is denied
* * Errno::EADDRINUSE - the _sockaddr_ is already in use
* * Errno::EADDRNOTAVAIL - the specified _sockaddr_ is not available from the
* local machine
- * * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for
+ * * Errno::EAFNOSUPPORT - the specified _sockaddr_ is not a valid address for
* the address family of the specified +socket+
* * Errno::EALREADY - a connection is already in progress for the specified
* socket
@@ -169,7 +169,7 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* refused the connection request
* * Errno::ECONNRESET - the remote host reset the connection request
* * Errno::EFAULT - the _sockaddr_ cannot be accessed
- * * Errno::EHOSTUNREACH - the destination host cannot be reached (probably
+ * * Errno::EHOSTUNREACH - the destination host cannot be reached (probably
* because the host is down or a remote router cannot reach it)
* * Errno::EINPROGRESS - the O_NONBLOCK is set for the +socket+ and the
* connection cannot be immediately established; the connection will be
@@ -179,46 +179,46 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* asynchronously
* * Errno::EISCONN - the specified +socket+ is already connected
* * Errno::EINVAL - the address length used for the _sockaddr_ is not a valid
- * length for the address family or there is an invalid family in _sockaddr_
+ * length for the address family or there is an invalid family in _sockaddr_
* * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
* PATH_MAX
* * Errno::ENETDOWN - the local interface used to reach the destination is down
* * Errno::ENETUNREACH - no route to the network is present
* * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOSR - there were insufficient STREAMS resources available to
+ * * Errno::ENOSR - there were insufficient STREAMS resources available to
* complete the operation
* * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
* * Errno::EOPNOTSUPP - the calling +socket+ is listening and cannot be connected
- * * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket
+ * * Errno::EPROTOTYPE - the _sockaddr_ has a different type than the socket
* bound to the specified peer address
* * Errno::ETIMEDOUT - the attempt to connect time out before a connection
* was made.
- *
+ *
* On unix-based systems if the address family of the calling +socket+ is
* AF_UNIX the follow exceptions may be raised if the call to _connect_
* fails:
- * * Errno::EIO - an i/o error occurred while reading from or writing to the
+ * * Errno::EIO - an i/o error occurred while reading from or writing to the
* file system
* * Errno::ELOOP - too many symbolic links were encountered in translating
* the pathname in _sockaddr_
- * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
+ * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
* characters, or an entire pathname exceeded PATH_MAX characters
* * Errno::ENOENT - a component of the pathname does not name an existing file
* or the pathname is an empty string
* * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_
- * is not a directory
- *
+ * is not a directory
+ *
* === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
+ * On Windows systems the following system exceptions may be raised if
* the call to _connect_ fails:
* * Errno::ENETDOWN - the network is down
* * Errno::EADDRINUSE - the socket's local address is already in use
* * Errno::EINTR - the socket was cancelled
* * Errno::EINPROGRESS - a blocking socket is in progress or the service provider
- * is still processing a callback function. Or a nonblocking connect call is
+ * is still processing a callback function. Or a nonblocking connect call is
* in progress on the +socket+.
* * Errno::EALREADY - see Errno::EINVAL
- * * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as
+ * * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as
* ADDR_ANY TODO check ADDRANY TO INADDR_ANY
* * Errno::EAFNOSUPPORT - addresses in the specified family cannot be used with
* with this +socket+
@@ -234,11 +234,11 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
* * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
* * Errno::ETIMEDOUT - the attempt to connect time out before a connection
* was made.
- * * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the
+ * * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the
* connection cannot be completed immediately
- * * Errno::EACCES - the attempt to connect the datagram socket to the
+ * * Errno::EACCES - the attempt to connect the datagram socket to the
* broadcast address failed
- *
+ *
* === See
* * connect manual pages on unix-based systems
* * connect function in Microsoft's Winsock functions reference
@@ -264,14 +264,14 @@ sock_connect(VALUE sock, VALUE addr)
/*
* call-seq:
* 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.
* Returns 0 if successful, otherwise an exception is raised.
- *
+ *
* === Parameter
* * +remote_sockaddr+ - the +struct+ sockaddr contained in a string or Addrinfo object
- *
+ *
* === Example:
* # Pull down Google's web page
* require 'socket'
@@ -283,15 +283,15 @@ sock_connect(VALUE sock, VALUE addr)
* rescue IO::WaitWritable
* IO.select(nil, [socket]) # wait 3-way handshake completion
* begin
- * socket.connect_nonblock(sockaddr) # check connection failure
+ * socket.connect_nonblock(sockaddr) # check connection failure
* rescue Errno::EISCONN
* end
* end
* socket.write("GET / HTTP/1.0\r\n\r\n")
- * results = socket.read
- *
+ * results = socket.read
+ *
* Refer to Socket#connect for the exceptions that may be thrown if the call
- * to _connect_nonblock_ fails.
+ * to _connect_nonblock_ fails.
*
* Socket#connect_nonblock may raise any error corresponding to connect(2) failure,
* including Errno::EINPROGRESS.
@@ -326,9 +326,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
/*
* call-seq:
* socket.bind(local_sockaddr) => 0
- *
+ *
* Binds to the given local address.
- *
+ *
* === Parameter
* * +local_sockaddr+ - the +struct+ sockaddr contained in a string or an Addrinfo object
*
@@ -345,9 +345,9 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.bind( sockaddr )
- *
+ *
* === Unix-based Exceptions
- * On unix-based based systems the following system exceptions may be raised if
+ * On unix-based based systems the following system exceptions may be raised if
* the call to _bind_ fails:
* * Errno::EACCES - the specified _sockaddr_ is protected and the current
* user does not have permission to bind to it
@@ -358,7 +358,7 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* the family of the calling +socket+
* * Errno::EBADF - the _sockaddr_ specified is not a valid file descriptor
* * Errno::EFAULT - the _sockaddr_ argument cannot be accessed
- * * Errno::EINVAL - the +socket+ is already bound to an address, and the
+ * * Errno::EINVAL - the +socket+ is already bound to an address, and the
* protocol does not support binding to the new _sockaddr_ or the +socket+
* has been shut down.
* * Errno::EINVAL - the address length is not a valid length for the address
@@ -366,12 +366,12 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
* PATH_MAX
* * Errno::ENOBUFS - no buffer space is available
- * * Errno::ENOSR - there were insufficient STREAMS resources available to
+ * * Errno::ENOSR - there were insufficient STREAMS resources available to
* complete the operation
* * Errno::ENOTSOCK - the +socket+ does not refer to a socket
- * * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support
+ * * Errno::EOPNOTSUPP - the socket type of the +socket+ does not support
* binding to an address
- *
+ *
* On unix-based based systems if the address family of the calling +socket+ is
* Socket::AF_UNIX the follow exceptions may be raised if the call to _bind_
* fails:
@@ -382,19 +382,19 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* * Errno::EIO - an i/o error occurred
* * Errno::ELOOP - too many symbolic links were encountered in translating
* the pathname in _sockaddr_
- * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
+ * * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
* characters, or an entire pathname exceeded PATH_MAX characters
* * Errno::ENOENT - a component of the pathname does not name an existing file
* or the pathname is an empty string
* * Errno::ENOTDIR - a component of the path prefix of the pathname in _sockaddr_
* is not a directory
* * Errno::EROFS - the name would reside on a read only filesystem
- *
+ *
* === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
+ * On Windows systems the following system exceptions may be raised if
* the call to _bind_ fails:
* * Errno::ENETDOWN-- the network is down
- * * Errno::EACCES - the attempt to connect the datagram socket to the
+ * * Errno::EACCES - the attempt to connect the datagram socket to the
* broadcast address failed
* * Errno::EADDRINUSE - the socket's local address is already in use
* * Errno::EADDRNOTAVAIL - the specified address is not a valid address for this
@@ -404,11 +404,11 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
* * Errno::EINVAL - the +socket+ is already bound to an address
* * Errno::ENOBUFS - no buffer space is available
* * Errno::ENOTSOCK - the +socket+ argument does not refer to a socket
- *
+ *
* === See
* * bind manual pages on unix-based systems
* * bind function in Microsoft's Winsock functions reference
- */
+ */
static VALUE
sock_bind(VALUE sock, VALUE addr)
{
@@ -425,14 +425,14 @@ sock_bind(VALUE sock, VALUE addr)
/*
* call-seq:
* 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
+ * to _listen_ only applies if the +socket+ is of type SOCK_STREAM or
* SOCK_SEQPACKET.
- *
+ *
* === Parameter
* * +backlog+ - the maximum length of the queue for pending connections.
- *
+ *
* === Example 1
* require 'socket'
* include Socket::Constants
@@ -440,43 +440,43 @@ sock_bind(VALUE sock, VALUE addr)
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.bind( sockaddr )
* socket.listen( 5 )
- *
+ *
* === Example 2 (listening on an arbitrary port, unix-based systems only):
* require 'socket'
* include Socket::Constants
* socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
* socket.listen( 1 )
- *
+ *
* === Unix-based Exceptions
* On unix based systems the above will work because a new +sockaddr+ struct
* is created on the address ADDR_ANY, for an arbitrary port number as handed
* off by the kernel. It will not work on Windows, because Windows requires that
* the +socket+ is bound by calling _bind_ before it can _listen_.
- *
+ *
* If the _backlog_ amount exceeds the implementation-dependent maximum
* queue length, the implementation's maximum queue length will be used.
- *
+ *
* On unix-based based systems the following system exceptions may be raised if the
* call to _listen_ fails:
* * Errno::EBADF - the _socket_ argument is not a valid file descriptor
- * * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and
+ * * Errno::EDESTADDRREQ - the _socket_ is not bound to a local address, and
* the protocol does not support listening on an unbound socket
* * Errno::EINVAL - the _socket_ is already connected
* * Errno::ENOTSOCK - the _socket_ argument does not refer to a socket
* * Errno::EOPNOTSUPP - the _socket_ protocol does not support listen
* * Errno::EACCES - the calling process does not have appropriate privileges
* * Errno::EINVAL - the _socket_ has been shut down
- * * Errno::ENOBUFS - insufficient resources are available in the system to
+ * * Errno::ENOBUFS - insufficient resources are available in the system to
* complete the call
- *
+ *
* === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
+ * On Windows systems the following system exceptions may be raised if
* the call to _listen_ fails:
* * Errno::ENETDOWN - the network is down
- * * Errno::EADDRINUSE - the socket's local address is already in use. This
+ * * Errno::EADDRINUSE - the socket's local address is already in use. This
* usually occurs during the execution of _bind_ but could be delayed
* if the call to _bind_ was to a partially wildcard address (involving
- * ADDR_ANY) and if a specific address needs to be committed at the
+ * ADDR_ANY) and if a specific address needs to be committed at the
* time of the call to _listen_
* * Errno::EINPROGRESS - a Windows Sockets 1.1 call is in progress or the
* service provider is still processing a callback function
@@ -487,7 +487,7 @@ sock_bind(VALUE sock, VALUE addr)
* * Errno::ENOTSOC - +socket+ is not a socket
* * Errno::EOPNOTSUPP - the referenced +socket+ is not a type that supports
* the _listen_ method
- *
+ *
* === See
* * listen manual pages on unix-based systems
* * listen function in Microsoft's Winsock functions reference
@@ -511,16 +511,16 @@ rsock_sock_listen(VALUE sock, VALUE log)
* call-seq:
* 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
* received. The second element, _sender_addrinfo_, contains protocol-specific
* address information of the sender.
- *
+ *
* === Parameters
* * +maxlen+ - the maximum number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
* === Example
* # In one file, start this first
* require 'socket'
@@ -534,7 +534,7 @@ rsock_sock_listen(VALUE sock, VALUE log)
* puts "I only received 20 bytes '#{data}'"
* sleep 1
* socket.close
- *
+ *
* # In another file, start this second
* require 'socket'
* include Socket::Constants
@@ -542,29 +542,29 @@ rsock_sock_listen(VALUE sock, VALUE log)
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.connect( sockaddr )
* socket.puts "Watch this get cut short!"
- * socket.close
- *
+ * socket.close
+ *
* === Unix-based Exceptions
* On unix-based based systems the following system exceptions may be raised if the
* call to _recvfrom_ fails:
* * Errno::EAGAIN - the +socket+ file descriptor is marked as O_NONBLOCK and no
* data is waiting to be received; or MSG_OOB is set and no out-of-band data
- * is available and either the +socket+ file descriptor is marked as
- * O_NONBLOCK or the +socket+ does not support blocking to wait for
+ * is available and either the +socket+ file descriptor is marked as
+ * O_NONBLOCK or the +socket+ does not support blocking to wait for
* out-of-band-data
* * Errno::EWOULDBLOCK - see Errno::EAGAIN
* * Errno::EBADF - the +socket+ is not a valid file descriptor
* * Errno::ECONNRESET - a connection was forcibly closed by a peer
- * * Errno::EFAULT - the socket's internal buffer, address or address length
+ * * Errno::EFAULT - the socket's internal buffer, address or address length
* cannot be accessed or written
* * Errno::EINTR - a signal interrupted _recvfrom_ before any data was available
* * Errno::EINVAL - the MSG_OOB flag is set and no out-of-band data is available
- * * Errno::EIO - an i/o error occurred while reading from or writing to the
+ * * Errno::EIO - an i/o error occurred while reading from or writing to the
* filesystem
- * * Errno::ENOBUFS - insufficient resources were available in the system to
+ * * Errno::ENOBUFS - insufficient resources were available in the system to
* perform the operation
* * Errno::ENOMEM - insufficient memory was available to fulfill the request
- * * Errno::ENOSR - there were insufficient STREAMS resources available to
+ * * Errno::ENOSR - there were insufficient STREAMS resources available to
* complete the operation
* * Errno::ENOTCONN - a receive is attempted on a connection-mode socket that
* is not connected
@@ -572,9 +572,9 @@ rsock_sock_listen(VALUE sock, VALUE log)
* * Errno::EOPNOTSUPP - the specified flags are not supported for this socket type
* * Errno::ETIMEDOUT - the connection timed out during connection establishment
* or due to a transmission timeout on an active connection
- *
+ *
* === Windows Exceptions
- * On Windows systems the following system exceptions may be raised if
+ * On Windows systems the following system exceptions may be raised if
* the call to _recvfrom_ fails:
* * Errno::ENETDOWN - the network is down
* * Errno::EFAULT - the internal buffer and from parameters on +socket+ are not
@@ -582,31 +582,31 @@ rsock_sock_listen(VALUE sock, VALUE log)
* too small to accommodate the peer address
* * Errno::EINTR - the (blocking) call was cancelled by an internal call to
* the WinSock function WSACancelBlockingCall
- * * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
+ * * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
* the service provider is still processing a callback function
* * Errno::EINVAL - +socket+ has not been bound with a call to _bind_, or an
* unknown flag was specified, or MSG_OOB was specified for a socket with
* SO_OOBINLINE enabled, or (for byte stream-style sockets only) the internal
* len parameter on +socket+ was zero or negative
* * Errno::EISCONN - +socket+ is already connected. The call to _recvfrom_ is
- * not permitted with a connected socket on a socket that is connection
+ * not permitted with a connected socket on a socket that is connection
* oriented or connectionless.
- * * Errno::ENETRESET - the connection has been broken due to the keep-alive
+ * * Errno::ENETRESET - the connection has been broken due to the keep-alive
* activity detecting a failure while the operation was in progress.
* * Errno::EOPNOTSUPP - MSG_OOB was specified, but +socket+ is not stream-style
* such as type SOCK_STREAM. OOB data is not supported in the communication
- * domain associated with +socket+, or +socket+ is unidirectional and
+ * domain associated with +socket+, or +socket+ is unidirectional and
* supports only send operations
- * * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to
+ * * Errno::ESHUTDOWN - +socket+ has been shutdown. It is not possible to
* call _recvfrom_ on a socket after _shutdown_ has been invoked.
- * * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to
+ * * Errno::EWOULDBLOCK - +socket+ is marked as nonblocking and a call to
* _recvfrom_ would block.
* * Errno::EMSGSIZE - the message was too large to fit into the specified buffer
* and was truncated.
* * Errno::ETIMEDOUT - the connection has been dropped, because of a network
* failure or because the system on the other end went down without
* notice
- * * Errno::ECONNRESET - the virtual circuit was reset by the remote side
+ * * Errno::ECONNRESET - the virtual circuit was reset by the remote side
* executing a hard or abortive close. The application should close the
* socket; it is no longer usable. On a UDP-datagram socket this error
* indicates a previous send operation resulted in an ICMP Port Unreachable
@@ -622,7 +622,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* call-seq:
* 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.
* _flags_ is zero or more of the +MSG_+ options.
@@ -633,11 +633,11 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns
* an empty string as data.
* The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc.
- *
+ *
* === Parameters
* * +maxlen+ - the maximum number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
* === Example
* # In one file, start this first
* require 'socket'
@@ -657,7 +657,7 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* puts "I only received 20 bytes '#{data}'"
* sleep 1
* socket.close
- *
+ *
* # In another file, start this second
* require 'socket'
* include Socket::Constants
@@ -665,10 +665,10 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
* sockaddr = Socket.sockaddr_in(2200, 'localhost')
* socket.connect(sockaddr)
* socket.puts "Watch this get cut short!"
- * socket.close
- *
+ * socket.close
+ *
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- * to _recvfrom_nonblock_ fails.
+ * to _recvfrom_nonblock_ fails.
*
* Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.
@@ -717,13 +717,13 @@ sock_accept(VALUE sock)
/*
* call-seq:
* socket.accept_nonblock => [client_socket, client_addrinfo]
- *
+ *
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* It returns an array containing the accepted socket
* for the incoming connection, _client_socket_,
* and an Addrinfo, _client_addrinfo_.
- *
+ *
* === Example
* # In one script, start this first
* require 'socket'
@@ -741,19 +741,19 @@ sock_accept(VALUE sock)
* puts "The client said, '#{client_socket.readline.chomp}'"
* client_socket.puts "Hello from script one!"
* socket.close
- *
+ *
* # In another script, start this second
* require 'socket'
* include Socket::Constants
* socket = Socket.new(AF_INET, SOCK_STREAM, 0)
* sockaddr = Socket.sockaddr_in(2200, 'localhost')
* socket.connect(sockaddr)
- * socket.puts "Hello from script 2."
+ * socket.puts "Hello from script 2."
* puts "The server said, '#{socket.readline.chomp}'"
* socket.close
- *
+ *
* Refer to Socket#accept for the exceptions that may be thrown if the call
- * to _accept_nonblock_ fails.
+ * to _accept_nonblock_ fails.
*
* Socket#accept_nonblock may raise any error corresponding to accept(2) failure,
* including Errno::EWOULDBLOCK.
@@ -761,7 +761,7 @@ sock_accept(VALUE sock)
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
* it is extended by IO::WaitReadable.
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
- *
+ *
* === See
* * Socket#accept
*/
@@ -781,11 +781,11 @@ sock_accept_nonblock(VALUE sock)
/*
* call-seq:
* 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_,
* and an Addrinfo, _client_addrinfo_.
- *
+ *
* === Example
* # In one script, start this first
* require 'socket'
@@ -799,20 +799,20 @@ sock_accept_nonblock(VALUE sock)
* puts "The client said, '#{client_socket.readline.chomp}'"
* client_socket.puts "Hello from script one!"
* socket.close
- *
+ *
* # In another script, start this second
* require 'socket'
* include Socket::Constants
* socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
* sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
* socket.connect( sockaddr )
- * socket.puts "Hello from script 2."
+ * socket.puts "Hello from script 2."
* puts "The server said, '#{socket.readline.chomp}'"
* socket.close
- *
+ *
* Refer to Socket#accept for the exceptions that may be thrown if the call
- * to _sysaccept_ fails.
- *
+ * to _sysaccept_ fails.
+ *
* === See
* * Socket#accept
*/
@@ -944,7 +944,7 @@ sock_s_gethostbyname(VALUE obj, VALUE host)
*
* Obtains the host information for _address_.
*
- * p Socket.gethostbyaddr([221,186,184,68].pack("CCCC"))
+ * p Socket.gethostbyaddr([221,186,184,68].pack("CCCC"))
* #=> ["carbon.ruby-lang.org", [], 2, "\xDD\xBA\xB8D"]
*/
static VALUE
@@ -1009,7 +1009,7 @@ sock_s_gethostbyaddr(int argc, VALUE *argv)
* Socket.getservbyname("smtp") #=> 25
* Socket.getservbyname("shell") #=> 514
* Socket.getservbyname("syslog", "udp") #=> 514
- */
+ */
static VALUE
sock_s_getservbyname(int argc, VALUE *argv)
{
@@ -1394,7 +1394,7 @@ sock_s_pack_sockaddr_un(VALUE self, VALUE path)
*
* _sockaddr_ should be a string or an addrinfo for AF_UNIX.
*
- * sockaddr = Socket.sockaddr_un("/tmp/sock")
+ * sockaddr = Socket.sockaddr_un("/tmp/sock")
* p Socket.unpack_sockaddr_un(sockaddr) #=> "/tmp/sock"
*
*/
@@ -1800,15 +1800,15 @@ socket_s_ip_address_list(VALUE self)
* The constants defined under Socket::Constants are also defined under Socket.
* For example, Socket::AF_INET is usable as well as Socket::Constants::AF_INET.
* See Socket::Constants for the list of constants.
- *
+ *
* === Exception Handling
* Ruby's implementation of +Socket+ causes an exception to be raised
* based on the error generated by the system dependent implementation.
* This is why the methods are documented in a way that isolate
* Unix-based system exceptions from Windows based exceptions. If more
- * information on particular exception is needed please refer to the
+ * information on particular exception is needed please refer to the
* Unix manual pages or the Windows WinSock reference.
- *
+ *
* === Convenient methods
*
* Although the general way to create socket is Socket.new,
@@ -1818,14 +1818,14 @@ socket_s_ip_address_list(VALUE self)
* * TCP server socket: Socket.tcp_server_loop, TCPServer.open
* * UNIX client socket: Socket.unix, UNIXSocket.open
* * UNIX server socket: Socket.unix_server_loop, UNIXServer.open
- *
+ *
* === Documentation by
* * Zach Dennis
* * Sam Roberts
- * * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
- *
- * Much material in this documentation is taken with permission from
- * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
+ * * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
+ *
+ * Much material in this documentation is taken with permission from
+ * <em>Programming Ruby</em> from The Pragmatic Bookshelf.
*/
void
Init_socket()
diff --git a/ext/socket/tcpserver.c b/ext/socket/tcpserver.c
index faa5ad5..282bd60 100644
--- a/ext/socket/tcpserver.c
+++ b/ext/socket/tcpserver.c
@@ -41,7 +41,7 @@ tcp_svr_init(int argc, VALUE *argv, VALUE sock)
* s.puts Time.now
* s.close
* }
- *
+ *
*/
static VALUE
tcp_accept(VALUE sock)
@@ -49,7 +49,7 @@ tcp_accept(VALUE sock)
rb_io_t *fptr;
struct sockaddr_storage from;
socklen_t fromlen;
-
+
GetOpenFile(sock, fptr);
fromlen = sizeof(from);
return rsock_s_accept(rb_cTCPSocket, fptr->fd,
@@ -59,11 +59,11 @@ tcp_accept(VALUE sock)
/*
* call-seq:
* tcpserver.accept_nonblock => tcpsocket
- *
+ *
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* It returns an accepted TCPSocket for the incoming connection.
- *
+ *
* === Example
* require 'socket'
* serv = TCPServer.new(2202)
@@ -74,9 +74,9 @@ tcp_accept(VALUE sock)
* retry
* end
* # sock is an accepted socket.
- *
+ *
* Refer to Socket#accept for the exceptions that may be thrown if the call
- * to TCPServer#accept_nonblock fails.
+ * to TCPServer#accept_nonblock fails.
*
* TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure,
* including Errno::EWOULDBLOCK.
@@ -84,7 +84,7 @@ tcp_accept(VALUE sock)
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED, Errno::EPROTO,
* it is extended by IO::WaitReadable.
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
- *
+ *
* === See
* * TCPServer#accept
* * Socket#accept
@@ -110,7 +110,7 @@ tcp_accept_nonblock(VALUE sock)
*
* TCPServer.open("127.0.0.1", 28561) {|serv|
* fd = serv.sysaccept
- * s = IO.for_fd(fd)
+ * s = IO.for_fd(fd)
* s.puts Time.now
* s.close
* }
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index e0ce443..b278523 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -137,7 +137,7 @@ udp_bind(VALUE sock, VALUE host, VALUE port)
* udpsocket.send(mesg, flags) => numbytes_sent
*
* Sends _mesg_ via _udpsocket_.
- *
+ *
* _flags_ should be a bitwise OR of Socket::MSG_* constants.
*
* u1 = UDPSocket.new
@@ -195,7 +195,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* call-seq:
* 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.
* If _maxlen_ is omitted, its default value is 65536.
@@ -206,11 +206,11 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* When recvfrom(2) returns 0,
* Socket#recvfrom_nonblock returns an empty string as data.
* It means an empty packet.
- *
+ *
* === Parameters
* * +maxlen+ - the number of bytes to receive from the socket
- * * +flags+ - zero or more of the +MSG_+ options
- *
+ * * +flags+ - zero or more of the +MSG_+ options
+ *
* === Example
* require 'socket'
* s1 = UDPSocket.new
@@ -228,7 +228,7 @@ udp_send(int argc, VALUE *argv, VALUE sock)
* end
*
* Refer to Socket#recvfrom for the exceptions that may be thrown if the call
- * to _recvfrom_nonblock_ fails.
+ * to _recvfrom_nonblock_ fails.
*
* UDPSocket#recvfrom_nonblock may raise any error corresponding to recvfrom(2) failure,
* including Errno::EWOULDBLOCK.
diff --git a/ext/socket/unixserver.c b/ext/socket/unixserver.c
index ef830bc..a6379eb 100644
--- a/ext/socket/unixserver.c
+++ b/ext/socket/unixserver.c
@@ -60,11 +60,11 @@ unix_accept(VALUE sock)
/*
* call-seq:
* unixserver.accept_nonblock => unixsocket
- *
+ *
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
* It returns an accepted UNIXSocket for the incoming connection.
- *
+ *
* === Example
* require 'socket'
* serv = UNIXServer.new("/tmp/sock")
@@ -75,9 +75,9 @@ unix_accept(VALUE sock)
* retry
* end
* # sock is an accepted socket.
- *
+ *
* Refer to Socket#accept for the exceptions that may be thrown if the call
- * to UNIXServer#accept_nonblock fails.
+ * to UNIXServer#accept_nonblock fails.
*
* UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure,
* including Errno::EWOULDBLOCK.
@@ -85,7 +85,7 @@ unix_accept(VALUE sock)
* If the exception is Errno::EWOULDBLOCK, Errno::AGAIN, Errno::ECONNABORTED or Errno::EPROTO,
* it is extended by IO::WaitReadable.
* So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.
- *
+ *
* === See
* * UNIXServer#accept
* * Socket#accept
@@ -115,7 +115,7 @@ unix_accept_nonblock(VALUE sock)
* fd = serv.sysaccept
* s = IO.new(fd)
* s.puts "hi"
- * s.close
+ * s.close
* p c.read #=> "hi\n"
* }
* }
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 4c3c5a7..e0b081a 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -89,7 +89,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
*
* s = UNIXSocket.new("/tmp/sock")
* s.send "hello", 0
- *
+ *
*/
static VALUE
unix_init(VALUE sock, VALUE path)
@@ -271,11 +271,11 @@ recvmsg_blocking(void *data)
* unixsocket.recv_io([klass [, mode]]) => io
*
* UNIXServer.open("/tmp/sock") {|serv|
- * UNIXSocket.open("/tmp/sock") {|c|
+ * UNIXSocket.open("/tmp/sock") {|c|
* s = serv.accept
*
- * c.send_io STDOUT
- * stdout = s.recv_io
+ * c.send_io STDOUT
+ * stdout = s.recv_io
*
* p STDOUT.fileno #=> 1
* p stdout.fileno #=> 7