Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'socket'
- class Server
- def initialize()
- @server_socket = TCPServer.new("127.0.0.1", 3000)
- run
- end
- def run
- loop do
- connection = @server_socket.accept
- puts connection.read
- connection.puts 'hey im putting things'
- connection.send 'hey', 0
- connection.print 'Hey from ruby\r\n'
- connection.close_write
- connection.close
- end
- end
- end
- Server.new()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement