public override int GetHashCode() { return(MaximumConnections + MaximumDownloadSpeed + MaximumUploadSpeed + MaximumHalfOpenConnections + ListenEndPoint?.GetHashCode() ?? 0 + AllowedEncryption.GetHashCode() + CacheDirectory.GetHashCode()); }
/// <summary> /// Start and listen ongoing TCP connections on the localhost on the given port /// </summary> /// <param name="port">port number of the connection. Use 0 for any availble port.</param> public ServerMock(int port) { var endpoint = new IPEndPoint(new IPAddress(new byte[] { 127, 0, 0, 1 }), port); _socket = new Socket(endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); _socket.Bind(endpoint); ListenEndPoint = _socket.LocalEndPoint as IPEndPoint; _socket.Listen((int)SocketOptionName.MaxConnections); var acceptEventArgs = GetAcceptEventArgs(); if (!_socket.AcceptAsync(acceptEventArgs)) { throw new Exception("Unable to listen on " + ListenEndPoint.ToString()); } _acceptedSockets = new List <Socket>(); ResponseHeader = new byte[MemcacheResponseHeader.SIZE]; }