Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Delay when connecting to another PC using WinSock

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
StanChart
Asked:
StanChart
  • 7
  • 4
  • 3
  • +2
4 Solutions
 
AndyAinscowCommented:
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
 
StanChartAuthor Commented:
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
 
AndyAinscowCommented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
StanChartAuthor Commented:
X -> A takes 30 secs but Y -> A takes zero
0
 
AndyAinscowCommented:
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
 
DanRollinsCommented:
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
 
mxjijoCommented:
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
 
StanChartAuthor Commented:
I think it might be a security issue because pinging is very quick.  How can I be sure?
0
 
AndyAinscowCommented:
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
 
StanChartAuthor Commented:
I managed to debug it and the function that causes the delay is gethostbyaddr().
0
 
stevejelCommented:
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
 
AndyAinscowCommented:
split
0
 
stevejelCommented:
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
 
AndyAinscowCommented:
I suggested split because there is good advice on how to eliminate possibilities (which helped identify the problem?) as well as the explaination.
0
 
stevejelCommented:
Haven't we done this already?

Cheers
Steve
0
 
AndyAinscowCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 4
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now