socket_protobuf
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -27,3 +27,3 @@ import { ServerSocket } from "./ServerSocket"; | ||
private readonly _connect_delay; | ||
socket: ServerSocket; | ||
server: ServerSocket; | ||
private _int_timeOut; | ||
@@ -30,0 +30,0 @@ private _connect_index; |
@@ -30,3 +30,3 @@ "use strict"; | ||
this.clearTimeOut(); | ||
this.handlerMgr = new HandlerMgr_1.HandlerMgr(this.socket); | ||
this.handlerMgr = new HandlerMgr_1.HandlerMgr(this.server); | ||
this.handlerMgr.getHandler(HandlerMgr_1.Cmd.ServerInfo).serverInfo = this; | ||
@@ -42,3 +42,3 @@ this.lineLogInfo(this.lineInfo + "服务器---连接成功\n\n正在请求服务器数据...\n"); | ||
if (this._is_init_ok) { | ||
return this.socket.send(cmdId, newBuff); | ||
return this.server.send(cmdId, newBuff); | ||
} | ||
@@ -96,3 +96,3 @@ return false; | ||
this._connect_stat = NetStatus.connecting; | ||
this.socket = new ServerSocket_1.ServerSocket(this.ip, this.port, [ | ||
this.server = new ServerSocket_1.ServerSocket(this.ip, this.port, [ | ||
this.onConnected.bind(this), | ||
@@ -104,3 +104,3 @@ this.onMessage.bind(this), | ||
]); | ||
this.socket.onConnect(); | ||
this.server.onConnect(); | ||
this.startTimeOut(); | ||
@@ -111,5 +111,5 @@ } | ||
this._connect_stat = NetStatus.start; | ||
if (this.socket != null) { | ||
this.socket.dispose(); | ||
this.socket = null; | ||
if (this.server != null) { | ||
this.server.dispose(); | ||
this.server = null; | ||
} | ||
@@ -116,0 +116,0 @@ } |
@@ -9,3 +9,3 @@ import { Socket } from "net"; | ||
private readonly _port; | ||
_client: Socket; | ||
socket: Socket; | ||
private _receiver; | ||
@@ -12,0 +12,0 @@ /**执行方法*/ |
@@ -31,6 +31,6 @@ "use strict"; | ||
this.removeEvent(); | ||
if (null != this._client) { | ||
this._client.end(); | ||
if (null != this.socket) { | ||
this.socket.end(); | ||
} | ||
this._client = null; | ||
this.socket = null; | ||
this._functions = null; | ||
@@ -43,5 +43,5 @@ this.clearReceiver(); | ||
} | ||
this._client = new net_1.Socket(); | ||
this.socket = new net_1.Socket(); | ||
this.addEvent(); | ||
this._client.connect(this._port, this._host, () => { | ||
this.socket.connect(this._port, this._host, () => { | ||
this._is_alive = true; | ||
@@ -52,15 +52,15 @@ this._functions[0].apply(null); | ||
addEvent() { | ||
this._client.addListener('data', this.onMessage.bind(this)); | ||
this._client.addListener('close', this.onClose.bind(this)); | ||
this._client.addListener('end', this.onEnd.bind(this)); | ||
this._client.addListener('error', this.onError.bind(this)); | ||
this.socket.addListener('data', this.onMessage.bind(this)); | ||
this.socket.addListener('close', this.onClose.bind(this)); | ||
this.socket.addListener('end', this.onEnd.bind(this)); | ||
this.socket.addListener('error', this.onError.bind(this)); | ||
} | ||
removeEvent() { | ||
this._client.removeListener('data', this.onMessage.bind(this)); | ||
this._client.removeListener('close', this.onClose.bind(this)); | ||
this._client.removeListener('end', this.onEnd.bind(this)); | ||
this._client.removeListener('error', this.onError.bind(this)); | ||
this.socket.removeListener('data', this.onMessage.bind(this)); | ||
this.socket.removeListener('close', this.onClose.bind(this)); | ||
this.socket.removeListener('end', this.onEnd.bind(this)); | ||
this.socket.removeListener('error', this.onError.bind(this)); | ||
} | ||
send(cmdId, newBuff) { | ||
return BufferSender_1.BufferSender.send(this._client, cmdId, newBuff); | ||
return BufferSender_1.BufferSender.send(this.socket, cmdId, newBuff); | ||
} | ||
@@ -67,0 +67,0 @@ onReceiveBuffer(buffer) { |
{ | ||
"name": "socket_protobuf", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "socket发送protobuf二进制流的SDK", | ||
@@ -5,0 +5,0 @@ "main": "App.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44777