method

bind

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: Addrinfo
bind() public

creates a socket bound to self.

If a block is given, it is called with the socket and the value of the block is returned. The socket is returned otherwise.

Addrinfo.udp("0.0.0.0", 9981).bind {|s|
  s.local_address.connect {|s| s.send "hello", 0 }
  p s.recv(10) #=> "hello"
}
Show source
Register or log in to add new notes.