kleinron

node-tcp-recv

Jun 16th, 2021
800
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const net = require('net');
  2.  
  3. const client = net.createConnection(4300, "72.18.253.119");
  4.  
  5. client.on('connect', () => {
  6.     console.log('connected')
  7. })
  8.  
  9. client.on('data', (data) => {
  10.     console.log('got data!');
  11.     const textMessage = data.toString('ascii').trim();
  12.     console.log(textMessage);
  13. });
  14. client.on('end', () => {
  15.     console.log('disconnected');
  16. });
  17.  
RAW Paste Data