コード例 #1
0
ファイル: Router.cs プロジェクト: Olivine-Labs/Tiamat
 public void Stop()
 {
     if (_alchemy != null)
     {
         _alchemy.Stop();
         _alchemy = null;
     }
 }
コード例 #2
0
ファイル: ClientServer.cs プロジェクト: Mondego/rcat-gs
        public ClientServer(ILog log)
        {
            Log = log;
            RegisterProxyMethods();
            // Client server uses Alchemy Websockets
            clientListener = new WSServer(Properties.Settings.Default.client_listener_port, IPAddress.Any);
            clientListener.Log.Logger.IsEnabledFor(log4net.Core.Level.Debug);
            clientListener.DefaultOnReceive = new OnEventDelegate(OnReceive);
            clientListener.DefaultOnSend = new OnEventDelegate(OnSend);
            clientListener.DefaultOnConnect = new OnEventDelegate(OnConnect);
            clientListener.DefaultOnDisconnect = new OnEventDelegate(OnDisconnect);
            clientListener.TimeOut = new TimeSpan(0, 10, 0); //Clients get kicked out if they do not send anything for 10 minutes

            clientListener.Start();
        }
コード例 #3
0
ファイル: Router.cs プロジェクト: Olivine-Labs/Tiamat
 public void Start()
 {
     if (_alchemy == null)
     {
         _alchemy = new WSServer(81, IPAddress.Any)
         {
             DefaultOnReceive = OnReceive,
             DefaultOnSend = OnSend,
             DefaultOnConnect = OnConnect,
             DefaultOnConnected = OnConnected,
             DefaultOnDisconnect = OnDisconnect,
             TimeOut = new TimeSpan(0, 5, 0)
         };
         _alchemy.Start();
     }
 }
コード例 #4
0
        /// <summary>
        /// Initialize the application and start the Alchemy Websockets server
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Initialize the server on port 81, accept any IPs, and bind events.
            WSServer AServer = new WSServer(81, IPAddress.Any);
            AServer.DefaultOnReceive = new OnEventDelegate(OnReceive);
            AServer.DefaultOnSend = new OnEventDelegate(OnSend);
            AServer.DefaultOnConnect = new OnEventDelegate(OnConnect);
            AServer.DefaultOnDisconnect = new OnEventDelegate(OnDisconnect);
            AServer.TimeOut = new TimeSpan(0, 5, 0);

            AServer.Start();

            // Accept commands on the console and keep it alive
            string Command = string.Empty;
            while (Command != "exit")
            {
                Command = Console.ReadLine();
            }

            AServer.Stop();
        }