Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Delay when connecting to another PC using WinSock

Posted on 2006-06-22
23
337 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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