Class: Libuv::TCP::SocketBase

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/libuv/tcp.rb

Direct Known Subclasses

Socket4, Socket6

Instance Method Summary collapse

Methods included from Resource

#check_result, #check_result!, #resolve, #to_ptr

Constructor Details

#initialize(loop, tcp, ip, port) ⇒ SocketBase

Returns a new instance of SocketBase.



134
135
136
# File 'lib/libuv/tcp.rb', line 134

def initialize(loop, tcp, ip, port)
    @tcp, @sockaddr = tcp, ip_addr(ip, port)
end

Instance Method Details

#bind ⇒ Object



138
139
140
# File 'lib/libuv/tcp.rb', line 138

def bind
    check_result!(tcp_bind)
end

#connect(callback) ⇒ Object



142
143
144
# File 'lib/libuv/tcp.rb', line 142

def connect(callback)
    check_result!(tcp_connect(callback))
end