TCP
Clients
connect
To connect to a remote TCP server, call the Socketry::TCP::Socket.connect method:
tcp_socket = Socketry::TCP::Socket.connect("github.com", 80)
Servers
new and open
To create a TCP server, call the Socketry::TCP::Server.new method with the address and port to bind to:
server = Socketry::TCP::Server.new("localhost", 12345)
You will need to remember to call #close on the server when you are done. To avoid this, the .open method accepts a block and auto-closes the server when it completes:
Socketry::TCP::Server.open("localhost", 12345) do |server| ... end