Permalink
Browse files

luvit tcp echo skeleton

  • Loading branch information...
1 parent f0efa1c commit cbeede2f7e9acbc805c2c140d96d799e644a77e8 @kengonakajima committed May 8, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 luvit/tcpecho.lua
View
@@ -0,0 +1,14 @@
+local net = require('net')
+
+local server
+server = net.createServer(function (client)
+
+ -- Echo everything the client says back to itself
+ client:pipe(client)
+
+ -- Also log it to the server's stdout
+ client:pipe(process.stdout)
+
+end):listen(8080)
+
+print("TCP echo server listening on port 8080")

0 comments on commit cbeede2

Please sign in to comment.