Created
February 6, 2013 20:09
-
-
Save geekgonecrazy/4725372 to your computer and use it in GitHub Desktop.
Node.js -> Python Socket Connection.
This file contains hidden or 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, sys | |
s = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) | |
s.connect( ('127.0.0.1', 8124) ) | |
s.send('test'); | |
s.close |
This file contains hidden or 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
var net = require('net'); | |
var server = net.createServer(function(c) { | |
console.log('server connected'); | |
c.on('end', function() { | |
console.log('server disconnected'); | |
}); | |
c.write('hello\r\n'); | |
c.on('data', function(data) { | |
console.log(data.toString()); | |
c.end(); | |
}); | |
}); | |
server.listen(8124, function() { | |
console.log('server bound to port: 8124'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment