Untitled
unknown
plain_text
23 days ago
933 B
2
Indexable
Never
const net = require('net'); const server = net.createServer((client) => { console.log('OPEN'); const socket = net.createConnection(80, '127.0.0.1', () => { console.log('REMOTE OPEN'); }); client.on('data', (data) => { console.log('WRITE:', data.toString('hex').match(/.{1,2}/g).join(' ')); socket.write(data); }); socket.on('data', (data) => { console.log('READ:', data.toString('hex').match(/.{1,2}/g).join(' ')); client.write(data); }); client.on('close', () => { console.log('CLOSE'); socket.end(); }); socket.on('close', () => { console.log('REMOTE CLOSE'); client.end(); }); client.on('error', (err) => { console.error('ERROR:', err); socket.end(); }); socket.on('error', (err) => { console.error('REMOTE ERROR:', err); client.end(); }); }); server.listen(1234);
Leave a Comment