{"_id":"tcp-base","_rev":"3018308","name":"tcp-base","description":"A base class for tcp client with basic functions","dist-tags":{"latest":"3.2.0"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"time":{"modified":"2023-11-02T08:19:18.000Z","created":"2016-09-18T04:52:17.842Z","3.2.0":"2023-08-30T14:11:49.006Z","3.1.1":"2022-09-01T14:55:50.049Z","3.1.0":"2017-12-01T06:39:23.880Z","1.1.2":"2017-08-16T06:34:45.499Z","1.1.1":"2017-08-11T08:39:26.291Z","3.0.0":"2017-04-20T03:44:19.913Z","2.0.0":"2017-02-17T13:21:01.363Z","1.1.0":"2016-11-30T03:14:45.449Z","1.0.2":"2016-11-11T02:44:07.790Z","1.0.1":"2016-10-20T04:31:33.347Z","1.0.0":"2016-09-18T04:52:17.842Z"},"users":{},"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"versions":{"3.2.0":{"name":"tcp-base","version":"3.2.0","description":"A base class for tcp client with basic functions","main":"lib/base.js","scripts":{"lint":"eslint --ext .js .","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 6.0.0"},"devDependencies":{"egg-bin":"^5.2.0","eslint":"^8.23.0","eslint-config-egg":"^12.0.0","mm":"^2.1.0","mz-modules":"^1.0.0","pedding":"^1.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^3.1.1"},"gitHead":"a13f7c099358af78073bc9e75484aa7bd7486e95","_id":"tcp-base@3.2.0","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"shasum":"bc83618edb26bb17bb9b082216ec242ec9137480","size":5420,"noattachment":false,"key":"/tcp-base/-/tcp-base-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-3.2.0.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tcp-base_3.2.0_1693404708851_0.16258012876931227"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-30T14:11:49.006Z","publish_time":1693404709006,"_source_registry_name":"default","_cnpm_publish_time":1693404709006},"3.1.1":{"name":"tcp-base","version":"3.1.1","description":"A base class for tcp client with basic functions","main":"lib/base.js","scripts":{"lint":"eslint --ext .js .","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","contributors":"contributors"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 6.0.0"},"ci":{"version":"14, 16, 18","os":"linux"},"devDependencies":{"contributors":"^0.5.1","egg-bin":"^5.2.0","egg-ci":"^2.1.0","eslint":"^8.23.0","eslint-config-egg":"^12.0.0","mm":"^2.1.0","mz-modules":"^1.0.0","pedding":"^1.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^3.1.1"},"gitHead":"d9d7084593b461db7335062d41dbc200e82df78c","_id":"tcp-base@3.1.1","_nodeVersion":"16.17.0","_npmVersion":"6.14.12","dist":{"shasum":"7daf9599b148919bc12fc3df14f49b89b748cca1","size":6088,"noattachment":false,"key":"/tcp-base/-/tcp-base-3.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-3.1.1.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tcp-base_3.1.1_1662044149868_0.28088717609108604"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-01T14:56:00.830Z","publish_time":1662044150049,"_cnpm_publish_time":1662044150049},"3.1.0":{"name":"tcp-base","version":"3.1.0","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"autod":"autod","lint":"eslint --ext .js .","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","contributors":"contributors"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 6.0.0"},"ci":{"version":"6, 7"},"devDependencies":{"autod":"^2.8.0","contributors":"^0.5.1","egg-bin":"^3.3.0","egg-ci":"^1.6.0","eslint":"^3.19.0","eslint-config-egg":"^3.2.0","mm":"^2.1.0","mz-modules":"^1.0.0","npminstall":"^2.29.1","pedding":"^1.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^3.1.1"},"gitHead":"531f1353543400967a5980c3fd9a634506f74d07","_id":"tcp-base@3.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},"dist":{"shasum":"35458bf8c0a21a0cacf5092b4c758a53b39317c1","size":5980,"noattachment":false,"key":"/tcp-base/-/tcp-base-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-3.1.0.tgz"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tcp-base-3.1.0.tgz_1512110363813_0.03317421954125166"},"directories":{},"publish_time":1512110363880,"_hasShrinkwrap":false,"_cnpm_publish_time":1512110363880},"1.1.2":{"name":"tcp-base","version":"1.1.2","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"autod":"autod","lint":"eslint --ext .js .","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"TEST_TIMEOUT=20000 egg-bin cov","ci":"npm run lint && npm run cov","contributors":"contributors"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 7"},"devDependencies":{"autod":"^2.9.0","await-event":"^2.1.0","contributors":"^0.5.1","egg-bin":"^1.11.1","egg-ci":"^1.8.0","eslint":"^4.4.1","eslint-config-egg":"^5.0.0","mm":"^2.1.0","mz-modules":"^1.0.0","pedding":"^1.1.0","webstorm-disable-index":"^1.2.0"},"dependencies":{"is-type-of":"^1.1.0","sdk-base":"^2.0.1"},"gitHead":"dec0b86ce827ebb272781b41dd3cd43262c2da9b","_id":"tcp-base@1.1.2","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"dist":{"shasum":"ec669ec1553897e74862dcb541fce3bc8e093131","size":5821,"noattachment":false,"key":"/tcp-base/-/tcp-base-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-1.1.2.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tcp-base-1.1.2.tgz_1502865285407_0.7274039876647294"},"directories":{},"publish_time":1502865285499,"_hasShrinkwrap":false,"_cnpm_publish_time":1502865285499},"1.1.1":{"name":"tcp-base","version":"1.1.1","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"autod":"autod","lint":"eslint --ext .js .","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"TEST_TIMEOUT=20000 egg-bin cov","ci":"npm run lint && npm run cov","contributors":"contributors"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 7"},"devDependencies":{"autod":"^2.9.0","await-event":"^2.1.0","contributors":"^0.5.1","egg-bin":"^1.11.1","egg-ci":"^1.8.0","eslint":"^4.4.1","eslint-config-egg":"^5.0.0","mm":"^2.1.0","mz-modules":"^1.0.0","pedding":"^1.1.0","webstorm-disable-index":"^1.2.0"},"dependencies":{"is-type-of":"^1.1.0","sdk-base":"^2.0.1"},"gitHead":"498b18a89a31df20a2f8b76c433346cd85355ff5","_id":"tcp-base@1.1.1","_npmVersion":"5.3.0","_nodeVersion":"8.1.4","_npmUser":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"dist":{"shasum":"e2f7ff058b08c6a336645494148b499168f0582e","size":5739,"noattachment":false,"key":"/tcp-base/-/tcp-base-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-1.1.1.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tcp-base-1.1.1.tgz_1502440766198_0.7347863144241273"},"directories":{},"publish_time":1502440766291,"_hasShrinkwrap":false,"_cnpm_publish_time":1502440766291},"3.0.0":{"name":"tcp-base","version":"3.0.0","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"autod":"autod","lint":"eslint --ext .js .","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","contributors":"contributors"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 6.0.0"},"ci":{"version":"6, 7"},"devDependencies":{"autod":"^2.8.0","contributors":"^0.5.1","egg-bin":"^3.3.0","egg-ci":"^1.6.0","eslint":"^3.19.0","eslint-config-egg":"^3.2.0","mm":"^2.1.0","mz-modules":"^1.0.0","npminstall":"^2.29.1","pedding":"^1.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^3.1.1"},"gitHead":"f9c56ee64afb38b4062e5f1a247db45cbce4192c","_id":"tcp-base@3.0.0","_shasum":"6156da6b6dd1d4a40d8379467f25ef1f9c946437","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"dist":{"shasum":"6156da6b6dd1d4a40d8379467f25ef1f9c946437","size":5750,"noattachment":false,"key":"/tcp-base/-/tcp-base-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-3.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/tcp-base-3.0.0.tgz_1492659857968_0.7933136411011219"},"directories":{},"publish_time":1492659859913,"_hasShrinkwrap":false,"_cnpm_publish_time":1492659859913},"2.0.0":{"name":"tcp-base","version":"2.0.0","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"autod":"autod -w --prefix '^'","lint":"eslint --ext .js lib test example","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 6.0.0"},"ci":{"version":"6, 7"},"devDependencies":{"autod":"^2.7.1","egg-bin":"^2.2.0","egg-ci":"^1.1.0","eslint":"^3.15.0","eslint-config-egg":"^3.2.0","mm":"^2.1.0","npminstall":"^2.24.0","pedding":"^1.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^3.1.0"},"gitHead":"1a379f3a6b084abb1e40f86d6a0918a9895b6ef6","_id":"tcp-base@2.0.0","_shasum":"cd9b2ec4fb033d090df2176e58637269180a3818","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"dist":{"shasum":"cd9b2ec4fb033d090df2176e58637269180a3818","size":5669,"noattachment":false,"key":"/tcp-base/-/tcp-base-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-2.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/tcp-base-2.0.0.tgz_1487337659578_0.759924108395353"},"directories":{},"publish_time":1487337661363,"_cnpm_publish_time":1487337661363,"_hasShrinkwrap":false},"1.1.0":{"name":"tcp-base","version":"1.1.0","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"lint":"eslint --ext .js lib test example","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint -- --fix && npm run cov"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 7"},"devDependencies":{"egg-bin":"1","egg-ci":"1","eslint":"3","eslint-config-egg":"3","mm":"2","npminstall":"2","pedding":"1","should":"11"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^2.0.1"},"gitHead":"74cb511afc10a196104ce4789811af9e1b681c1f","_id":"tcp-base@1.1.0","_shasum":"5b2dcffbc51fb3c3add05c298388be34e6470cd4","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"5b2dcffbc51fb3c3add05c298388be34e6470cd4","size":5593,"noattachment":false,"key":"/tcp-base/-/tcp-base-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-1.1.0.tgz"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/tcp-base-1.1.0.tgz_1480475684826_0.09407295333221555"},"directories":{},"publish_time":1480475685449,"_cnpm_publish_time":1480475685449,"_hasShrinkwrap":false},"1.0.2":{"name":"tcp-base","version":"1.0.2","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"lint":"eslint --ext .js lib test example","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint -- --fix && npm run cov"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6"},"devDependencies":{"egg-bin":"1","egg-ci":"1","eslint":"3","eslint-config-egg":"3","mm":"2","npminstall":"2","pedding":"1","should":"11"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^2.0.1"},"gitHead":"277aceed35b71266bac6d06c3c474fcfdf10976b","_id":"tcp-base@1.0.2","_shasum":"69e2c43133bd56935c4fb5a7afcd588328dde6d3","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"69e2c43133bd56935c4fb5a7afcd588328dde6d3","size":5552,"noattachment":false,"key":"/tcp-base/-/tcp-base-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-1.0.2.tgz"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/tcp-base-1.0.2.tgz_1478832247254_0.40998436394147575"},"directories":{},"publish_time":1478832247790,"_cnpm_publish_time":1478832247790,"_hasShrinkwrap":false},"1.0.1":{"name":"tcp-base","version":"1.0.1","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"lint":"eslint --ext .js lib test example","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6"},"devDependencies":{"egg-bin":"^1.3.0","egg-ci":"^1.0.3","eslint":"^3.5.0","eslint-config-egg":"^3.1.0","mm":"^2.0.0","npminstall":"^2.2.2","pedding":"^1.0.0","should":"^11.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^2.0.1"},"gitHead":"463a77f5c155ee93d4f17437b8b7591d1451c022","_id":"tcp-base@1.0.1","_shasum":"8878c988c47606fd49da366b49e03ff2999f0035","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.0","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"8878c988c47606fd49da366b49e03ff2999f0035","size":5244,"noattachment":false,"key":"/tcp-base/-/tcp-base-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-1.0.1.tgz"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/tcp-base-1.0.1.tgz_1476937892766_0.9244369487278163"},"directories":{},"publish_time":1476937893347,"_cnpm_publish_time":1476937893347,"_hasShrinkwrap":false},"1.0.0":{"name":"tcp-base","version":"1.0.0","description":"A base class for tcp client with basic functions","main":"lib/base.js","files":["lib"],"scripts":{"lint":"eslint --ext .js lib test example","test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov"},"repository":{"type":"git","url":"git+https://github.com/node-modules/tcp-base.git"},"keywords":["tcp"],"author":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"homepage":"https://github.com/node-modules/tcp-base#readme","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6"},"devDependencies":{"egg-bin":"^1.3.0","egg-ci":"^1.0.3","eslint":"^3.5.0","eslint-config-egg":"^3.1.0","mm":"^2.0.0","npminstall":"^2.2.2","pedding":"^1.0.0","should":"^11.1.0"},"dependencies":{"is-type-of":"^1.0.0","sdk-base":"^2.0.1"},"gitHead":"083fcafc32ad422a78d3970f0d0f58eed9f0257e","_id":"tcp-base@1.0.0","_shasum":"d71cb44ea6959c516be7a5aebe012753e93dad50","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.5.0","_npmUser":{"name":"gxcsoccer","email":"gxcsoccer@126.com"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"gxcsoccer","email":"gxcsoccer@gmail.com"},{"name":"shaoshuai0102","email":"shaoshuai0102@gmail.com"}],"dist":{"shasum":"d71cb44ea6959c516be7a5aebe012753e93dad50","size":5202,"noattachment":false,"key":"/tcp-base/-/tcp-base-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/tcp-base/download/tcp-base-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/tcp-base-1.0.0.tgz_1474174335949_0.544915450969711"},"directories":{},"publish_time":1474174337842,"_cnpm_publish_time":1474174337842,"_hasShrinkwrap":false}},"readme":"# tcp-base\n\nA base class for tcp client with basic functions\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/node-modules/tcp-base/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/tcp-base/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/tcp-base.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/tcp-base\n[codecov-image]: https://codecov.io/gh/node-modules/tcp-base/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/tcp-base\n[download-image]: https://img.shields.io/npm/dm/tcp-base.svg?style=flat-square\n[download-url]: https://npmjs.org/package/tcp-base\n\n## Install\n\n```bash\nnpm install tcp-base --save\n```\n\nNode.js >= 6.0.0 required\n\n## Usage\n\nA quick guide to implement a tcp echo client\n\nClient:\n\n```js\nconst TCPBase = require('tcp-base');\n\n/**\n * A Simple Protocol:\n *   (4B): request id\n *   (4B): body length\n *   ------------------------------\n *   body data\n */\nclass Client extends TCPBase {\n  getHeader() {\n    return this.read(8);\n  }\n\n  getBodyLength(header) {\n    return header.readInt32BE(4);\n  }\n\n  decode(body, header) {\n    return {\n      id: header.readInt32BE(0),\n      data: body,\n    };\n  }\n\n  // heartbeat packet\n  get heartBeatPacket() {\n    return Buffer.from([ 255, 255, 255, 255, 0, 0, 0, 0 ]);\n  }\n}\n\nconst client = new Client({\n  host: '127.0.0.1',\n  port: 8080,\n});\n\nconst body = Buffer.from('hello');\nconst data = Buffer.alloc(8 + body.length);\ndata.writeInt32BE(1, 0);\ndata.writeInt32BE(body.length, 4);\nbody.copy(data, 8, 0);\n\nclient.send({\n  id: 1,\n  data,\n  timeout: 5000,\n}, (err, res) => {\n  if (err) {\n    console.error(err);\n  }\n  console.log(res.toString()); // should echo 'hello'\n});\n```\n\nServer:\n\n```js\n'use strict';\n\nconst net = require('net');\n\nconst server = net.createServer(socket => {\n  let header;\n  let bodyLen;\n\n  function readPacket() {\n    if (bodyLen == null) {\n      header = socket.read(8);\n      if (!header) {\n        return false;\n      }\n      bodyLen = header.readInt32BE(4);\n    }\n\n    if (bodyLen === 0) {\n      socket.write(header);\n    } else {\n      const body = socket.read(bodyLen);\n      if (!body) {\n        return false;\n      }\n      socket.write(Buffer.concat([ header, body ]));\n    }\n    bodyLen = null;\n    return true;\n  }\n\n  socket.on('readable', () => {\n    try {\n      let remaining = false;\n      do {\n        remaining = readPacket();\n      }\n      while (remaining);\n    } catch (err) {\n      console.error(err);\n    }\n  });\n});\nserver.listen(8080);\n```\n\n[MIT](LICENSE)\n","_attachments":{},"homepage":"https://github.com/node-modules/tcp-base#readme","bugs":{"url":"https://github.com/node-modules/tcp-base/issues"},"license":"MIT"}