Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function myFoo( input, socket ){
- // socket seems to have lost some properties
- console.dir( socket );
- }
- function myFun( input, socket ){
- if( input.toString('utf-8', 0, input.length).search(/\r?\n/) > 0)
- {
- socket.crlf = true;
- socket.removeAllListeners( 'data' );
- socket.on( 'data', function( e ){
- myFoo( e, socket );
- });
- }
- }
- var net = require('net');
- var server = net.createServer( function( socket ){
- socket.on( 'data', function( e ){
- myFun( e, this );
- } );
- } );
- server.listen( 8080, null, function(){
- console.log( 'Server now listening on port 8080' );
- } );
Add Comment
Please, Sign In to add comment