Slow Stream Socket Connection
I'm connecting to a remote server via a stream socket and am experiencing exceptionally slow connection times. For example, using a valid IP address and port number, the following code finishes connecting to the server in 4 to 7 seconds. using System;
using System.Net.Sockets;
*****************************************
namespace TCPClient
{
public class TCPClient
{
public TCPClient()
{
TcpClient client;
client = new TcpClient();
client.Connect("123.123.123.123", 99999);
}
static void Main()
{
new TCPClient();
}
}
}
*****************************************
Corresponding code in Java, or C++ completes in a few milliseconds.
Does anybody have any suggestions as to why this may be occurring?
Re: Slow Stream Socket Connection
Quote:
Originally posted by stolentomato
I'm connecting to a remote server via a stream socket and am experiencing exceptionally slow connection times. For example, using a valid IP address and port number, the following code finishes connecting to the server in 4 to 7 seconds. using System;
using System.Net.Sockets;
*****************************************
namespace TCPClient
{
public class TCPClient
{
public TCPClient()
{
TcpClient client;
client = new TcpClient();
client.Connect("123.123.123.123", 99999);
}
static void Main()
{
new TCPClient();
}
}
}
*****************************************
Corresponding code in Java, or C++ completes in a few milliseconds.
Does anybody have any suggestions as to why this may be occurring?
Have you tried using a plain Socket and connecting that way?