Module: Socket::SocketExtensions::ClassMethods

Defined in:
lib/ruckus/extensions/socket.rb

Instance Method Summary collapse

Instance Method Details

#addr(host, port = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/ruckus/extensions/socket.rb', line 4

def addr(host, port=nil)
    if not port
        raise "bad!" if not host =~ /(.*):(.*)/
        host = $1
        port = $2
    end
    port = port.to_i
    Socket.pack_sockaddr_in(port, host)
end