# HG changeset patch # User Ivo Smits # Date 1413029171 -7200 # Node ID 4ba4fd48e1dad930f7095929968f29a5cdb2d11b # Parent 327be921600696a617c79f941c6bfe890710ec36 Removed old TCP socket (non)blocking code diff -r 327be9216006 -r 4ba4fd48e1da Net/TCPServer.cs --- a/Net/TCPServer.cs Sat Oct 11 14:05:41 2014 +0200 +++ b/Net/TCPServer.cs Sat Oct 11 14:06:11 2014 +0200 @@ -88,7 +88,6 @@ _Listener = new Socket(af, SocketType.Stream, ProtocolType.Tcp); - _Listener.Blocking = false; _Listener.Bind(new IPEndPoint(af == AddressFamily.InterNetworkV6 ? IPAddress.IPv6Any : IPAddress.Any, Port)); _Listener.Listen(25); _ThrottleCounter = _ThrottleBurst; @@ -184,7 +183,6 @@ internal Client(Socket Socket, TCPServer Server) : base(Socket) { _Server = Server; - Socket.Blocking = true; base.Closed += _Stream_Closed; this.Tag = Server; } @@ -197,11 +195,8 @@ bool CloseSocket = true; try { try { - base.Blocking = true; //base.NoDelay = true; base.ReadTimeout = 5000; - base.WriteBufferSize = 1024 * 10; - base.ReadBufferSize = 1024 * 10; //Console.WriteLine("TCPServer: Accepted connection from " + base.Socket.RemoteEndPoint.ToString()); _MagicNumber = (byte)base.PeekByte(); } catch (TimeoutException ex) { diff -r 327be9216006 -r 4ba4fd48e1da Net/TCPStream.cs --- a/Net/TCPStream.cs Sat Oct 11 14:05:41 2014 +0200 +++ b/Net/TCPStream.cs Sat Oct 11 14:06:11 2014 +0200 @@ -19,7 +19,6 @@ private ulong _BytesWritten; private ulong _BytesRead; private DateTime _StartTime; - private bool _Blocking; public event EventHandler Closed; @@ -27,7 +26,6 @@ _Socket = Socket; _HasPeekByte = false; _StartTime = DateTime.Now; - _Blocking = _Socket.Blocking; } public Socket Socket { @@ -39,11 +37,8 @@ } public bool Blocking { - get { return _Blocking; } - set { - Socket.Blocking = value; - _Blocking = value; - } + get { return _Socket.Blocking; } + set { Socket.Blocking = value; } } public bool NoDelay { @@ -91,7 +86,6 @@ } catch (SocketException ex) { switch (ex.SocketErrorCode) { case SocketError.WouldBlock: - _Socket.Blocking = _Blocking; throw new TimeoutException("The receive operation would block", ex); case SocketError.TimedOut: throw new TimeoutException("The receive operation timed out", ex); @@ -212,7 +206,6 @@ } catch (SocketException ex) { switch (ex.SocketErrorCode) { case SocketError.WouldBlock: - _Socket.Blocking = _Blocking; throw new TimeoutException("The send operation would block", ex); case SocketError.TimedOut: throw new TimeoutException("The send operation timed out", ex);