Last active
December 5, 2016 00:51
-
-
Save ChunChunMorning/3fbc731c412adcc6591f9c22e4b85680 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("127.0.0.1", 50000); | |
puts "Server is running at 50000." | |
socket = server.accept(); | |
socket.write("welcome\n"); | |
loop { | |
message = socket.gets(); | |
if (message.nil?()) | |
break; | |
end | |
puts("socekt: " + message); | |
socket.write(message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment