A Transmission Control Protocol (TCP/IP) socket.
Usage example:
require "socket" client = TCPSocket.new("localhost", 1234) client << "message\n" response = client.gets client.close
Creates a new TCP connection to a remote TCP server.
Creates a new TCPSocket
, waiting to be connected.
Creates a TCPSocket from an already configured raw file descriptor
Opens a TCP socket to a remote TCP server, yields it to the block, then eventually closes the socket when the block returns.
The number of probes sent, without response before dropping the connection.
The amount of time in seconds the connection must be idle before sending keepalive probes.
The amount of time in seconds between keepalive probes.
Disables the Nagle algorithm when set to true
, otherwise enables it.
Returns true
if the Nable algorithm is disabled.
IPSocket
Socket
Socket
Socket
IO::Evented
IO::Buffered
IO
IO
Reference
Reference
Object
Object
Creates a new TCP connection to a remote TCP server.
You may limit the DNS resolution time with dns_timeout
and limit the connection time to the remote server with connect_timeout
. Both values must be in seconds (integers or floats).
Note that dns_timeout
is currently ignored.
Creates a new TCPSocket
, waiting to be connected.
Creates a TCPSocket from an already configured raw file descriptor
Opens a TCP socket to a remote TCP server, yields it to the block, then eventually closes the socket when the block returns.
Returns the value of the block.
The number of probes sent, without response before dropping the connection.
The amount of time in seconds the connection must be idle before sending keepalive probes.
The amount of time in seconds between keepalive probes.
Disables the Nagle algorithm when set to true
, otherwise enables it.
Returns true
if the Nable algorithm is disabled.
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/TCPSocket.html