Created
October 9, 2017 11:37
-
-
Save killme2008/d83759f1844efb567acf54442c11c063 to your computer and use it in GitHub Desktop.
Echo server in lemon lang.
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
import 'socket'; | |
var ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM); | |
socket.bind(ss, 8080); | |
socket.listen(ss); | |
while(true) { | |
var s = socket.accept(ss); | |
var msg = socket.recv(s[0]); | |
while(msg.trim() != "exit") { | |
socket.send(s[0], msg); | |
msg = socket.recv(s[0]); | |
} | |
socket.shutdown(s[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment