Skip to content

Instantly share code, notes, and snippets.

@KrakenHH
Created June 11, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KrakenHH/d155aab17ab5f618848760ebcbf5be4c to your computer and use it in GitHub Desktop.
Save KrakenHH/d155aab17ab5f618848760ebcbf5be4c to your computer and use it in GitHub Desktop.
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