Exemple #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    //Free other state (managed objects)
                    m_closing = true;
                    if (m_socket.Connected)
                    {
                        m_socket.Shutdown(SocketShutdown.Both);
                    }
                    m_socket.Close();
                    m_socket = null;
                }
                //Free your own state (unmanaged objects)
                //Set large filed to null.
                m_IP = null;

                m_security     = null;
                m_recv_buffer  = null;
                m_recv_packets = null;
                m_send_buffers = null;

                disposed = true;
            }
        }
Exemple #2
0
        public ClientSocket(int index, Socket connectingSocket)
        {
            m_index  = index;
            m_socket = connectingSocket;
            m_IP     = m_socket.RemoteEndPoint.ToString().Split(':')[0];
            m_Port   = Convert.ToUInt16(m_socket.RemoteEndPoint.ToString().Split(':')[1]);

            m_recv_buffer = new TransferBuffer(8192, 0, 0);

            BeginPacketRecv();

            m_security = new Framework.SilkroadSecurityApi.Security();
            m_security.ChangeIdentity(Codes.IdentityName, Codes.IdentityFlag);
            m_security.GenerateSecurity(true, true, true);
        }