Пример #1
0
		protected bool Equals(TSocketSettings other)
		{
			return SendBufferSize == other.SendBufferSize 
				&& ReceiveBufferSize == other.ReceiveBufferSize 
				&& SendTimeout == other.SendTimeout 
				&& ReceiveTimeout == other.ReceiveTimeout 
				&& ConnectTimeout == other.ConnectTimeout;
		}
 protected bool Equals(TSocketSettings other)
 {
     return(SendBufferSize == other.SendBufferSize &&
            ReceiveBufferSize == other.ReceiveBufferSize &&
            SendTimeout == other.SendTimeout &&
            ReceiveTimeout == other.ReceiveTimeout &&
            ConnectTimeout == other.ConnectTimeout);
 }
Пример #3
0
        public TSocketV2(TSocketSettings settings)
            : base(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
        {
            SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, settings.SendBufferSize);
            SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, settings.ReceiveBufferSize);
            SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, settings.SendTimeout);
            SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, settings.ReceiveTimeout);

            this.settings       = settings;
            buildSocketCallback = new AsyncCallback(BuildSocketCallback);
            receiveCallback     = new AsyncCallback(ReceiveCallback);
            LastError           = SocketError.Success;
        }
Пример #4
0
		public TSocketV2(TSocketSettings settings)
			: base(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
		{
			SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, settings.SendBufferSize);
			SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, settings.ReceiveBufferSize);
			SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, settings.SendTimeout);
			SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, settings.ReceiveTimeout);

			this.settings = settings;
			buildSocketCallback = new AsyncCallback(BuildSocketCallback);
			receiveCallback = new AsyncCallback(ReceiveCallback);
			LastError = SocketError.Success;
		}
		public TFramedTransport(string host, int port, TSocketSettings socketSettings)
		{
			if (string.IsNullOrEmpty(host))
				throw new ArgumentNullException("host");
			if (socketSettings == null)
				throw new ArgumentNullException("socketSettings");

			if (host.ToLowerInvariant() == "localhost")
			{
				host = "127.0.0.1";
			}
			remoteEndPoint = new IPEndPoint(IPAddress.Parse(host), port);
			socket = new TSocketV2(socketSettings);
		}
Пример #6
0
        public TFramedTransport(string host, int port, TSocketSettings socketSettings)
        {
            if (string.IsNullOrEmpty(host))
            {
                throw new ArgumentNullException("host");
            }
            if (socketSettings == null)
            {
                throw new ArgumentNullException("socketSettings");
            }

            if (host.ToLower() == "localhost")
            {
                host = "127.0.0.1";
            }
            remoteEndPoint = new IPEndPoint(IPAddress.Parse(host), port);
            socket         = new TSocketV2(socketSettings);
        }