public void Close(bool isCallback = true) { if (socket != null) { socket.Close(); } if (package != null) { package.Clear(); } if (readStream != null) { readStream.Close(); } if (binaryReader != null) { binaryReader.Close(); } if (writeStream != null) { writeStream.Close(); } if (binaryWriter != null) { binaryWriter.Close(); } package = null; receiveThread = null; socket = null; CloseCheckConnectingTimer(); CloseCheckConnectedTimer(); if (isCallback) { SetState(ConnectState.Close); } }
private void CreateMessage(BufferPackage package) { receiveHandler(new Package(package.opcode, package.rpcId, package.bytes)); package.Clear(); }