573 |
573 |
OnConnecting(this, EventArgs.Empty);
|
574 |
574 |
}
|
575 |
575 |
try {
|
576 |
|
System.Net.IPAddress ip = System.Net.Dns.Resolve(Address).AddressList[0];
|
577 |
|
|
578 |
|
_TcpClient = new TcpClient();
|
579 |
|
_TcpClient.NoDelay = true;
|
580 |
|
_TcpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);
|
581 |
|
// set timeout, after this the connection will be aborted
|
582 |
|
_TcpClient.ReceiveTimeout = _SocketReceiveTimeout * 1000;
|
583 |
|
_TcpClient.SendTimeout = _SocketSendTimeout * 1000;
|
584 |
|
|
585 |
576 |
if (_ProxyType != ProxyType.None) {
|
586 |
577 |
IProxyClient proxyClient = null;
|
587 |
578 |
ProxyClientFactory proxyFactory = new ProxyClientFactory();
|
... | ... | |
605 |
596 |
);
|
606 |
597 |
}
|
607 |
598 |
|
608 |
|
_TcpClient.Connect(_ProxyHost, _ProxyPort);
|
|
599 |
_TcpClient = new TcpClient(_ProxyHost, _ProxyPort);
|
609 |
600 |
proxyClient.TcpClient = _TcpClient;
|
610 |
|
proxyClient.CreateConnection(ip.ToString(), port);
|
|
601 |
proxyClient.CreateConnection(Address, port);
|
611 |
602 |
} else {
|
612 |
|
_TcpClient.Connect(ip, port);
|
|
603 |
_TcpClient = new TcpClient(Address, port);
|
613 |
604 |
}
|
|
605 |
|
|
606 |
_TcpClient.NoDelay = true;
|
|
607 |
_TcpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);
|
|
608 |
// set timeout, after this the connection will be aborted
|
|
609 |
_TcpClient.ReceiveTimeout = _SocketReceiveTimeout * 1000;
|
|
610 |
_TcpClient.SendTimeout = _SocketSendTimeout * 1000;
|
614 |
611 |
|
615 |
612 |
Stream stream = _TcpClient.GetStream();
|
616 |
613 |
if (_UseSsl) {
|
617 |
|
-
|