Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / March 2005

Tip: Looking for answers? Try searching our database.

TCP Connection: big time to response

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rurum - X - 22 Mar 2005 20:09 GMT
Hi,
I am implementing an application with  tcp communication using the class
System.Net.Sockets.TcpClient, but the connection process require 10 seconds
or more, in the code line:

TcpClient tcpClient = new TcpClient(ip, port);
or
tcpClient.Connect();

When I use a TcpPower component, I don't need more than 1 second in the
connection.
Anybody have some idea about the reason for this behavior and how I can
reduce the connection time ?

Thanks a lot for your help.
Steve Lutz - 25 Mar 2005 04:20 GMT
My guess is it is the time for DNS to resolve, since you are using the
constructor:

public TcpClient(
  string hostname,
  int port
);

if you know the IP address, then use the constructor:
[C#]
public TcpClient(
  IPEndPoint localEP
);

The following example demonstrates how to create an instance of the
TcpClient class using a local endpoint.
//Creates a TCPClient using a localend point.
IPAddress ipAddress = ipaddress;
IPEndPoint ipLocalEndPoint = new IPEndPoint(ipAddress, port);
try{
        TcpClient tcpClientA = new TcpClient(ipLocalEndPoint);
}
catch (Exception e ) {
         Console.WriteLine(e.ToString());
 }

(Sample is from MSDN)

> Hi,
> I am implementing an application with  tcp communication using the class
[quoted text clipped - 11 lines]
>
> Thanks a lot for your help.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.