Example #1
0
        void onShutdown(ShutdownCode code, byte[] data)
        {
            var cback = Handler;

            if (cback != null)
            {
                try { cback.OnShutdown(this, code, data); }
                catch (Exception err) { Helper.RaiseUnexpected(err); }
            }
        }
Example #2
0
 void IWebSocketHandler.OnShutdown(WebSocket sender, ShutdownCode code, byte[] data)
 {
     // ignore ?
 }
Example #3
0
		void onShutdown( ShutdownCode code, byte[] data )
		{
			var cback = Handler;
			if (cback != null)
				try { cback.OnShutdown( this, code, data ); }
				catch (Exception err) { Helper.RaiseUnexpected( err ); }
		}
Example #4
0
		public void SendClose( ShutdownCode? code = null, byte[] data = null )
		{
			Helper.CheckArg( data == null || data.Length < 124, "Shutdown.data.Length must be less than 124" );
			Helper.CheckArg( code.HasValue || data == null, "If data is not null than ShutdownCode must be set" );

			if (code.HasValue)
			{
				var bcode = BitConverter.GetBytes( IPAddress.HostToNetworkOrder( ( short )code.Value ) );
				if (data != null)
				{
					var buf = new byte[ 2 + data.Length ];
					Array.Copy( bcode, buf, 2 );
					Array.Copy( data, 0, buf, 2, data.Length );
					data = buf;
				}
				else
					data = bcode;
			}
			send( Opcode.Close, data, true );
		}
Example #5
0
 void IWebSocketHandler.OnShutdown(WebSocket sender, ShutdownCode code, byte[] data)
 {
     // ignore ?
 }