method
recvfrom
v2_5_5 -
Show latest stable
-
0 notes -
Class: UNIXSocket
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (38)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (9)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
recvfrom(*args)
public
Receives a message via unixsocket.
maxlen is the maximum number of bytes to receive.
flags should be a bitwise OR of Socket::MSG_* constants.
outbuf will contain only the received data after the method call even if it is not empty at the beginning.
s1 = Socket.new(:UNIX, :DGRAM, 0) s1_ai = Addrinfo.unix("/tmp/sock1") s1.bind(s1_ai) s2 = Socket.new(:UNIX, :DGRAM, 0) s2_ai = Addrinfo.unix("/tmp/sock2") s2.bind(s2_ai) s3 = UNIXSocket.for_fd(s2.fileno) s1.send "a", 0, s2_ai p s3.recvfrom(10) #=> ["a", ["AF_UNIX", "/tmp/sock1"]]