Hello,

I'm not sure if this is in the correct area, so I apologize if it is wrong. But here is my scenario. I wrote a program that plots data in real-time. Once an X-Y value is calculated it is plotted onto a PictureBox, then the value is sent over Winsock to a remote location.

===== Pseudo Code (server) ======

Calculate value
FillRect PictureBox.hWnd 'Clear image
MoveTo X0,Y0
LineTo Xn,Yn 'Repeat if needed
InvalidateRect PictureBox.hWnd
Winsock.SendData Xn-Yn

DoEvents 'May be repeated several times, or just once

'Repeat the process all over again, continuously
=============================

Now, the client code is able to accept the data with GetData and plot it on it's end with no problems. So here is my big problem, if I comment out the InvalidateRect line of my server code I get a really, really, fast data transfer across the client/server. This fast transfer is what I want. If I leave in the InvalidateRect then the transfer runs at about 1/3 of the speed.
I've tried PictureBox.Refresh and UpdateWindow. InvalidateRect seems to allow for Winsock.SendData to work the fastest. But with this line commented out the PictureBox never updates its display (screen) on the server side. How can I get the display to update without having the network card, or Winsock, reach an internal timeout that simply sends the little data that is in the buffer? Or, is there a faster/better method then InvalidateRect? One way I could fix this is to have an internal count of data points and internal timeout, e.g.:

If( (GetTickCount() - lLastCount > 50 ms) or nPointCount > 5 ) Then Winsock.SendData

But I am hoping to not do this, I am trying to find a more elegant API method for the GDI issue.

Please help, I am very stumped.

Thank you and sorry for the long message.