Last active
September 29, 2020 16:30
-
-
Save pjambet/0c2f7dc2f059398f57c7864f885b8abe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
socket = TCPSocket.new 'localhost', 2000 | |
socket.write "request" | |
socket.close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
server = TCPServer.new 2000 | |
client = server.accept | |
IO.select([client]) | |
client.write "response!" | |
client.close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
server = TCPServer.new 2000 | |
client = server.accept | |
IO.select([client]) | |
p client.write "response!" | |
p client.write "response!" | |
client.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment