NetCoreServer
NetCoreServer copied to clipboard
Problem with closing codes
I need to handle closed codes, but I always get the code 1005, I use firefox as a client.
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;
}
Fixed in 8.0.1