Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 private void CreateMessage(BufferPackage package)
 {
     receiveHandler(new Package(package.opcode, package.rpcId, package.bytes));
     package.Clear();
 }