Skip to content

Instantly share code, notes, and snippets.

@kylestev
Created October 27, 2015 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylestev/6c666a312358e9fd0aa0 to your computer and use it in GitHub Desktop.
Save kylestev/6c666a312358e9fd0aa0 to your computer and use it in GitHub Desktop.
import { Socket } from 'net';
import * as struct from 'bufferpack';
let sock = new Socket({ readable: true, writable: true });
sock.connect({
host: 'oldschool1.runescape.com',
port: 43594
}, () => {
// first we bind a listener to all incoming data
sock.on('data', (buff) => {
let versionPacket = buff.readInt8(0);
let verisionIsCurrent = (versionPacket !== OP_OUTDATED);
// ^ is a boolean, do what ever you want with it now;
});
// then we send our data
sock.write(struct.pack('>bi', [15, revision]));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment