aboutsummaryrefslogtreecommitdiffstats
path: root/ext/socket
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-14 03:49:30 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-14 03:49:30 +0000
commitca4397ad2c8a89593e60b1d20bae88a983f79388 (patch)
treed0bc837af06bdecc25496a8ece3e1e200e70b985 /ext/socket
parent8283be280c62c15e04fa8d4c2c5145ceaa39de18 (diff)
downloadruby-ca4397ad2c8a89593e60b1d20bae88a983f79388.tar.gz
update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/socket.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index a8f38ce9f2..1ddaea9594 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -142,6 +142,14 @@ rsock_socketpair(int domain, int type, int protocol, int sv[2])
* _protocol_ should be a protocol defined in the domain,
* defaults to 0 for the domain.
*
+ * s1, s2 = Socket.pair(:UNIX, :STREAM, 0)
+ * s1.send "a", 0
+ * s1.send "b", 0
+ * s1.close
+ * p s2.recv(10) #=> "ab"
+ * p s2.recv(10) #=> ""
+ * p s2.recv(10) #=> ""
+ *
* s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)
* s1.send "a", 0
* s1.send "b", 0