8000 TCP · socketry/socketry Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Tony Arcieri edited this page Nov 26, 20 8000 16 · 2 revisions

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
Clone this wiki locally
0