Chromium Code Reviews| Index: frog/samples/node/echoServer.dart |
| =================================================================== |
| --- frog/samples/node/echoServer.dart (revision 0) |
| +++ frog/samples/node/echoServer.dart (revision 0) |
| @@ -0,0 +1,16 @@ |
| +#library('echoServer'); |
| + |
| +#import('../../lib/node/node.dart'); |
| +#import('../../lib/node/net.dart'); |
| + |
| +void main() { |
| + // Note: the callback function must use the type "Socket" for the socket argument, |
|
Jennifer Messerly
2012/01/21 01:00:31
hmmm. There's some sort of bug here then. You mean
|
| + // otherwise frog will strip out the Socket.write method. |
| + var server = net.createServer((Socket socket) { |
| + socket.write("Echo server\r\n"); |
| + socket.pipe(socket); |
| + }); |
| + |
| + server.listen(1337, "127.0.0.1"); |
| + print('Listening on port 1337'); |
| +} |