Skip to content

Instantly share code, notes, and snippets.

@KrakenHH

KrakenHH/test.rb Secret

Created June 11, 2016 18:47
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/0ab4f8e518aeba3bbfc80b56fe97f88f to your computer and use it in GitHub Desktop.
Save KrakenHH/0ab4f8e518aeba3bbfc80b56fe97f88f 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