Created
June 11, 2016 18:39
-
-
Save KrakenHH/d155aab17ab5f618848760ebcbf5be4c 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' | |
server = TCPServer.open(2000) | |
loop { | |
client = server.accept | |
client_request = client.read | |
client.print "Hello there?" | |
client.close | |
} | |
____________________________________________ | |
require 'socket' | |
host = 'localhost' | |
port = 2000 | |
path = "/index.html" | |
request = "testing?" | |
socket = TCPSocket.open(host,port) | |
socket.print "hellooo?" | |
response = socket.readlines | |
puts response | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment