Class: Kgio::TCPSocket
- Inherits:
-
TCPSocket
- Object
- TCPSocket
- Kgio::TCPSocket
- Includes:
- SocketMethods
- Defined in:
- ext/kgio/connect.c,
ext/kgio/connect.c
Overview
Kgio::TCPSocket should be used in place of the plain TCPSocket when kgio_* methods are needed.
Class Method Summary collapse
-
.new(ip, port) ⇒ Object
Kgio::TCPSocket.new(‘127.0.0.1’, 80) -> socket.
-
.start(ip, port) ⇒ Object
Kgio::TCPSocket.start(‘127.0.0.1’, 80) -> socket.
Class Method Details
.new(ip, port) ⇒ Object
Kgio::TCPSocket.new(‘127.0.0.1’, 80) -> socket
Creates a new Kgio::TCPSocket object and initiates a non-blocking connection.
This may block and call any method defined to kgio_wait_writable
for the class.
Unlike the TCPSocket.new in Ruby, this does NOT perform DNS lookups (which is subject to a different set of timeouts and best handled elsewhere).
220 221 222 223 |
# File 'ext/kgio/connect.c', line 220
static VALUE kgio_tcp_connect(VALUE klass, VALUE ip, VALUE port)
{
return tcp_connect(klass, ip, port, 1);
}
|
.start(ip, port) ⇒ Object
Kgio::TCPSocket.start(‘127.0.0.1’, 80) -> socket
Creates a new Kgio::TCPSocket object and initiates a non-blocking connection. The caller should select/poll on the socket for writability before attempting to write or optimistically attempt a write and handle :wait_writable or Errno::EAGAIN.
Unlike the TCPSocket.new in Ruby, this does NOT perform DNS lookups (which is subject to a different set of timeouts and best handled elsewhere).
240 241 242 243 |
# File 'ext/kgio/connect.c', line 240
static VALUE kgio_tcp_start(VALUE klass, VALUE ip, VALUE port)
{
return tcp_connect(klass, ip, port, 0);
}
|