예제 #1
0
 /// <summary>
 /// Creates a communication channel using ServerIpAddress and ServerPort.
 /// </summary>
 /// <returns>Ready communication channel to communicate</returns>
 protected override ICommunicationChannel CreateCommunicationChannel()
 {
     return(new TcpCommunicationChannel(
                TcpHelper.ConnectToServer(
                    new IPEndPoint(IPAddress.Parse(_serverEndPoint.IpAddress), _serverEndPoint.TcpPort),
                    ConnectTimeout
                    )));
 }
예제 #2
0
        /// <summary>
        /// Creates a communication channel using ServerIpAddress and ServerPort.
        /// </summary>
        /// <returns>Ready communication channel to communicate</returns>
        protected override ICommunicationChannel CreateCommunicationChannel(params Tuple <SocketOptionLevel, SocketOptionName, object>[] socketOptions)
        {
            EndPoint endpoint = null;

            if (IsStringIp(_serverEndPoint.IpAddress))
            {
                endpoint = new IPEndPoint(IPAddress.Parse(_serverEndPoint.IpAddress), _serverEndPoint.TcpPort);
            }
            else
            {
                endpoint = new DnsEndPoint(_serverEndPoint.IpAddress, _serverEndPoint.TcpPort);
            }

            return(new TcpCommunicationChannel(TcpHelper.ConnectToServer(endpoint, ConnectTimeout, socketOptions)));
        }
예제 #3
0
        /// <summary>
        /// Creates a communication channel using ServerIpAddress and ServerPort.
        /// </summary>
        /// <returns>Ready communication channel to communicate</returns>
        protected override ICommunicationChannel CreateCommunicationChannel()
        {
            EndPoint endpoint = null;

            if (IsStringIp(_serverEndPoint.IpAddress))
            {
                endpoint = new IPEndPoint(IPAddress.Parse(_serverEndPoint.IpAddress), _serverEndPoint.TcpPort);
            }
            else
            {
                endpoint = new DnsEndPoint(_serverEndPoint.IpAddress, _serverEndPoint.TcpPort);
            }

            return(new TcpCommunicationChannel(
                       TcpHelper.ConnectToServer(
                           endpoint,
                           ConnectTimeout
                           )));
        }
예제 #4
0
        /// <summary>
        /// Creates a communication channel using ServerIpAddress and ServerPort.
        /// </summary>
        /// <returns>Ready communication channel to communicate</returns>
        protected override ICommunicationChannel CreateCommunicationChannel()
        {
            EndPoint endpoint = null;

            if (IsStringIp(_serverEndPoint.IpAddress))
            {
                endpoint = new IPEndPoint(IPAddress.Parse(_serverEndPoint.IpAddress), _serverEndPoint.TcpPort);
            }
            else
            {
                throw new System.NotSupportedException("DnsEndPoint нет в net 3.5. Используйте строковое представление ip. Возможно тут заменить на обычный IPEndPoint?");
                //endpoint = new DnsEndPoint(_serverEndPoint.IpAddress, _serverEndPoint.TcpPort);
            }

            return(new TcpCommunicationChannel(
                       TcpHelper.ConnectToServer(
                           endpoint,
                           ConnectTimeout
                           )));
        }