示例#1
0
        protected override void OnDestroy()
        {
            if (onProxyConnected != null)
            {
                onProxyConnected.Dispose();
                onProxyConnected = null;
            }
            if (onProxyRecv != null)
            {
                onProxyRecv.Dispose();
                onProxyRecv = null;
            }
            if (proxyClient != null)
            {
                proxyClient.Close();
                proxyClient = null;
            }
            if (onConnected != null)
            {
                onConnected.Dispose();
                onConnected = null;
            }
            if (onRecv != null)
            {
                onRecv.Dispose();
                onRecv = null;
            }
            TcpIpServer.Shutdown();

            base.OnDestroy();
        }
示例#2
0
        public void Respond(string responseString)
        {
            if (!string.IsNullOrEmpty(responseString))
            {
                if (Preferences.ReplaceHex)
                {
                    responseString = Utilities.ConvertAllHex(responseString, Preferences.ServerStringEncoding);
                }

                server.Send(responseString);
                stateReporter.Report("Response sent to " + server.RemoteEndPoint + ":", responseString, true);
            }

            if (CloseConnectionAfterRespondingEnabled)
            {
                server.Shutdown(false);
            }
        }