Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Echo-server/CoffeeScript/echo-server.coffee
Normal file
17
Task/Echo-server/CoffeeScript/echo-server.coffee
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
net = require("net")
|
||||
server = net.createServer (conn) ->
|
||||
console.log "Connection from #{conn.remoteAddress} on port #{conn.remotePort}"
|
||||
conn.setEncoding "utf8"
|
||||
buffer = ""
|
||||
conn.on "data", (data) ->
|
||||
i = 0
|
||||
|
||||
while i <= data.length
|
||||
char = data.charAt(i)
|
||||
buffer += char
|
||||
if char is "\n"
|
||||
conn.write buffer
|
||||
buffer = ""
|
||||
i++
|
||||
|
||||
server.listen 12321, "localhost"
|
||||
Loading…
Add table
Add a link
Reference in a new issue