recvfrom(*args) public

Receives a message and return the message as a string and an address which the message come from.

maxlen is the maximum number of bytes to receive.

flags should be a bitwise OR of Socket::MSG_* constants.

ipaddr is same as IPSocket#{peeraddr,addr}.

u1 = UDPSocket.new
u1.bind("", 4913)
u2 = UDPSocket.new
u2.send "uuuu", 0, "", 4913
p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", ""]]
Show source
Register or log in to add new notes.