I’m behind a proxy and can’t connect with TcpClient to GMail’s POP3. I get the following error:
System.Net.Sockets.SocketException (0x80004005): No such host is known
Any clues?
Code:
var tcpClient = new TcpClient();
try
{
tcpClient.ReceiveTimeout = 60000;
tcpClient.SendTimeout = 60000;
tcpClient.Connect("pop.gmail.com", 995);
output.AppendLine("Connection OK!");
}
catch (SocketException e)
{
output.AppendLine(e.ToString());
}
finally
{
tcpClient.Close();
}
app.config (proxy is set up in Internet Explorer):
<?xml version="1.0"?>
<configuration>
<system.net>
<defaultProxy>
<proxy usesystemdefault="True" />
</defaultProxy>
</system.net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Nothing. Not possible. It looks like:
Possible workarounds:
At the end, you can have it both ways – either you force all clients through a proxy, or you have outgiong direct TCP connections.