Flowdock
method

udp_server_recv

Importance_1
v1_9_3_392 - Show latest stable - 0 notes - Class: Socket
udp_server_recv(sockets) public

Receive UDP/IP packets from the given sockets. For each packet received, the block is called.

The block receives msg and msg_src. msg is a string which is the payload of the received packet. msg_src is a Socket::UDPSource object which is used for reply.

Socket.udp_server_loop can be implemented using this method as follows.

udp_server_sockets(host, port) {|sockets|
  loop {
    readable, _, _ = IO.select(sockets)
    udp_server_recv(readable) {|msg, msg_src| ... }
  }
}
Show source
Register or log in to add new notes.