NetCoreServer icon indicating copy to clipboard operation
NetCoreServer copied to clipboard

Problem with closing codes

Open jusoGames opened this issue 4 years ago • 1 comments

I need to handle closed codes, but I always get the code 1005, I use firefox as a client.

jusoGames avatar Mar 29 '21 07:03 jusoGames

SendClose, never send status, this is a temporary solution,

     public void close(int code,string text)
        {
            
            byte [] status= BitConverter.GetBytes((short)code);
            Array.Reverse(status);
            byte[] datas = Combine(status, Encoding.UTF8.GetBytes(text));
            SendClose(0, datas, 0, datas.Length);            
            base.Disconnect();

        }

        public  byte[] Combine(byte[] first, byte[] second)
        {
            byte[] ret = new byte[first.Length + second.Length];
            System.Buffer.BlockCopy(first, 0, ret, 0, first.Length);
            System.Buffer.BlockCopy(second, 0, ret, first.Length, second.Length);
            return ret;
        }

jusoGames avatar Mar 29 '21 17:03 jusoGames

Fixed in 8.0.1

chronoxor avatar Nov 19 '23 20:11 chronoxor