summaryrefslogtreecommitdiff
path: root/code/snippets/socketpair.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/snippets/socketpair.rb')
-rw-r--r--code/snippets/socketpair.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/code/snippets/socketpair.rb b/code/snippets/socketpair.rb
new file mode 100644
index 0000000..06ae044
--- /dev/null
+++ b/code/snippets/socketpair.rb
@@ -0,0 +1,3 @@
+require 'socket'
+Socket.pair(:UNIX, :DGRAM, 0) #=> [#<Socket:fd 15>, #<Socket:fd 16>]
+