/// <summary> /// Refuses the connection /// </summary> public async Task Refuse() { if ((Requestor && !Loopback) || Open) { return; } TcpCSSocketControl control = new TcpCSSocketControl(SocketId, TcpCSSocketControl.RefuseConnection); EP.TCPConnection.Stream.Write(control.Build()); await Close(false); }
/// <summary> /// Accepts the connection /// </summary> public async Task Accept() { await Task.Run(() => { if ((Requestor && !Loopback) || Open) { return; } Stream = new NRStream(this); TcpCSSocketControl control = new TcpCSSocketControl(SocketId, TcpCSSocketControl.AcceptConnection); EP.TCPConnection.Stream.Write(control.Build()); Open = true; }); }