🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

tcptools

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tcptools

## simple demo

npmnpm
Version
1.0.3
Version published
Weekly downloads
1
-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

tcptools

simple demo

var net         = require('net');
var tcptools    = require('tcptools');
var path        = require('path');
var protobufjs  = require('protobufjs');
var TestProto = protobufjs.loadProtoFile(path.resolve(__dirname, "./test.proto"));

var TestMsg= AcMailProto.build("ACMOBA.Protocol.Test.TestMsg"),

var client = net.connect({
    host: 127.0.0.1,
    port: 2222
}, function () {
    console.log('connected to server!');
    var msgSender = tcptools.MessageSender(TestMsg, client);//获取指定消息的sender
    msgSender.send(msg); //发送数据
});

var msgReader = tcptools.MessageReader(TestMsg); //获取指定消息的reader
client.on('data', function (data) {
    var res = msgReader.read(data); //读取数据
    while (res) {
        console.log(res);
        res = msgReader.read(null);
        client.end();
    }
});

FAQs

Package last updated on 12 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts