PDA

Click to See Complete Forum and Search --> : [RESOLVED] Winsock severly slows down when sending to remote location


UWGRAD
Apr 28th, 2010, 10:22 PM
Hello,

This post is a long one, so hang on...

Quick note: Using VB6 with SP6.

I have been writing a program for awhile that takes real-time data from instruments, plots the data to the screen via my X-Y scatter graph and sends the data to anyone connected to the server. All clients get real-time updates at their machines.

Here is the problem, everything runs fast and smooth until I connect to the server from a farther location, say at home, or in another building at school. To get an idea of the slow down I connected several PC's to the same router as the server. The server is a dual core 3 GHz machine and the clients are single core 1.8 GHz machines. Even when I blast the slow clients with a ton of data they keep up and plot without a flaw; so I know the algorithms are OK.
But, when I go to another building and connect to the server the data rate is deathly slow. Another thing, when I do a bulk data transfer or send to the client, it is blazing fast (even at a remote location). I can send thousands of data points in the blink of an eye. It is on the real-time data that is slowing way down when at a remote location. The real-time data transfer seems to be only a few data points per second. The SendData command sends about 20 bytes of data each time (Winsock.SendData "x,y" - Len("x,y") is about 20 chars on average).

Here is some pseudo code:

====== Server v1 ===========
GetDataPointsFromInstruments
frmGraph.PlotData (x, y)
For All Clients
Winsock.SendData "x,y"
Next
=======================

====== Server v2 ===========
GetDataPointsFromInstruments
frmGraph.PlotData (x, y)
For All Clients
Winsock.SendData "x,y"
While( SendComplete = False )
DoEvents
Wend
Next
========================

====== Server v3 ===========
While Delay
DoEvents
Wend
GetDataPointsFromInstruments
frmGraph.PlotData (x, y)
For All Clients
Winsock.SendData "x,y"
Wait for send complete is/was also added here
Next
=======================

====== Server BulkTransfer ===========
For All Clients
Winsock.SendData "Xn,Yn"

While SendComplete = False
DoEvents
Wend
Next
'Where Xn and Yn are the data points being sent in series
================================

The Delay is simply a multimedia timer that is created, once it expires it sets a boolean value which will cause the Delay to stop looping. I have this because a user may need to set a time delay so the instruments can function properly. The time delay is usually 1 to 10 milliseconds.
None of the above implementations, or combination of, seem to fix the issue.

Also, I have another thread under 'GDI functions are slowing down Winsock'.

Please help, this problem has gotten the better of me. One more thing, when I've been testing it out I've been the only user connected so there hasn't been any hang up from other PCs.

Lastly, I've tried sending 50 data points at a time. I wait for 50 points to be read then do a mini-bulk transfer. This doesn't help at all.

Thank you

UWGRAD
May 4th, 2010, 11:35 AM
Found the issue. When I run the server from inside the school's network, the data transfer is extremely slow when sending to a remote location. So I tested it by running the server on my home PC and connecting in to it from school, the client at school receives data extremely fast. So it is an issue with the school's network such as firewalls, etc.