Solved

Delay when connecting to another PC using WinSock

Posted on 2006-06-22
23
326 Views
Last Modified: 2013-11-20
Hi,

I have an application that allows users to communicate with each other.  I use WinSock for this communication.  We've recently been upgraded to WinXP and I've been getting complaints that for some users, they can send data to another user on the network instantly, but for other users, it takes about 30 seconds to connect.  The application is not really processing anything at this point.  It just hangs for 30 seconds.

Anyone know of any local network settings that would cause this delay?

I don't think this is a coding issue, more like a setting on the PC or configuration of the network adapter on that PC.

Thanks
0
Comment
Question by:StanChart
  • 7
  • 4
  • 3
  • +2
23 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 16961970
The recipient.  Is it always either quick or slow?  (I'm thinking some setting on the computer being connected to - security / firewall settings of Win XP)
0
 

Author Comment

by:StanChart
ID: 16962246
I was just messing around with this a bit more.  I tried to send him data and it took about 30 seconds to send it from my PC (I can send the same data to a PC right next to him instantly).  My application sends back acknowledgements once it receives data and it took about the same time to send the ack from his PC to mine.  

My application is listed in the exceptions tab of the windows firewall on both machines.  

Do you think comparing an ipconfig /all report from both PC's would tell me anything?  It gives WINS and DNS server info which in this case is irrelevant since I have the IP right?

Thanks
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 125 total points
ID: 16962584
I'm not a network specialist so treat what I say with caution.

ipconfig - well, it is quick to do and if you did see some anomaly then it would be well worth it.


To help myself and other experts lets get some definitions into place.
Your PC (call it A) sends to PC (call it X) and it takes 30 seconds before X receives it.  
Your PC sends to another PC (call it Y) and it takes approx zero seconds before Y receives it.  


I'm unclear on the response.   X responds to A in about the same time as Y responds to A (30 secs or zero?), or X -> A takes 30 secs but Y -> A takes zero?
0
 

Author Comment

by:StanChart
ID: 16962695
X -> A takes 30 secs but Y -> A takes zero
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 16962831
How does the ipconfig /all for each of the three PC's compare?  Anything odd?  At a guess Y and A should be very similar but if X has a difference not shared by Y and A...



Have you tried pinging the IP adress of X and Y from A ?  (ping /? for help if you haven't used it before)
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 125 total points
ID: 16972979
Also mainly guessing, but it is probably related to security... Perhaps Y has already cached the credentials for machine A.  

Can A get to X and Y equally when using Explorer to access the hard disks?  After doing so, does the program run the same speed for both X and Y?

One thing to try:  Add the user from machine A as a login on Machine X.
0
 
LVL 8

Assisted Solution

by:mxjijo
mxjijo earned 125 total points
ID: 16988471
Are A and X in the same subnet ?
Are there multiple n/w interfaces (ip addresses) for any of these machines ?
As AndyAinscow  suggested did you try pinging X from A ? Does it go fast  or timing out ?
You may try tracert as well to see if the packets are taking some weird route.

Another option is to use a n/w sniffer and see where the bottle neck is.
If security is the issue -I believe- you'll see packets reaching X on time, but delivery to application getting delayed.

~j

0
 

Author Comment

by:StanChart
ID: 16989170
I think it might be a security issue because pinging is very quick.  How can I be sure?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 16990208
If pinging is quick that seems to imply no network bottleneck.

Did you try Dans suggestion of having the same user logged onto A and X and see if that improves the performance?

I'd still check the (windows XP) firewall settings on X and Y to see if there is any difference.
0
 

Author Comment

by:StanChart
ID: 17216054
I managed to debug it and the function that causes the delay is gethostbyaddr().
0
 
LVL 2

Assisted Solution

by:stevejel
stevejel earned 125 total points
ID: 17501458
I'm also no network expert, but gethostbyaddr() does a reverse DNS lookup, it translates the IP address to the hostname.  Potentially on computer Y there is no reverse DNS entry associated with the IP address, this could then trigger a DHCP lookup, causing the delay.  '

Try doing:
nslookup {ip}
on the two IP addresses, do you get a delay in one or a "non-existant domain" on computer Y?

If this is the case, try either removing the gethostbyaddr() from the code and connect straight to the IP that you already have, or explicitly set the IP address for the computer in question in Internet Protocols(TCP/IP) ->Properties within network properties
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18027339
split
0
 
LVL 2

Expert Comment

by:stevejel
ID: 18027381
I entered extremely late in this question (was one of the first questions I participated in), it was pretty abandoned before I got here, so am happy to forgo points for a split with the others who were contributing to a "live" question

Steve
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18113366
I suggested split because there is good advice on how to eliminate possibilities (which helped identify the problem?) as well as the explaination.
0
 
LVL 2

Expert Comment

by:stevejel
ID: 18372106
Haven't we done this already?

Cheers
Steve
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 18372984
It's an automated request from Dan (some other cleanup volunteers use this approach as well), it spams questions that are 'flagged' as abandoned.  There have been a number of discussions as to whether it is a good approach or not.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video discusses moving either the default database or any database to a new volume.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now