Winsock - problem sending a large amount of data
Hi there, I am creating a small program to send a picture using winsock.
So far the app that is sending the data, as far as I can see is working fine. I am storing the RGB value of each pixel in a 2d array as follows:
VB Code:
width = picture1.width
height = picture1.height
dim picArray(width, height) as long
for x = 0 to width
[INDENT]for y = 0 to height[/INDENT]
[INDENT]picArray(x,y), picture1.point(x,y)[/INDENT]
[INDENT]sck.senddata picArray(x,y)[/INDENT]
[INDENT]next[/INDENT]
next
If I run a similar loop in the same program to display the data from the array using PSet, the picture displays fine, however when I send the data to the other program it only recieves upto x = 4, the rest of the array has been assigned an RGB value of the same value when x = 4 and the last value of y.
I have tried to send it as a string with a comma as a delimiter, but again it only sends data upto x = 4.
I was thinking maybe there is a limit on how big the data can be??
Any suggestion would be appreciated
Regards
Re: Winsock - problem sending a large amount of data
there is indeed a limit on how much data can be sent through a winsock senddata function, it should still send all the data, just in chunks, so you need to reconstruct the data on the recieving system
Re: Winsock - problem sending a large amount of data
So for example;
VB Code:
dim incomeData as long
dim incomeDataArr(width, height)
for x = 0 to width
[INDENT]for y = 0 to height[/INDENT]
[INDENT]sck.getdata incomeData[/INDENT]
[INDENT]incomeDataArr(x,y) = incomeData[/INDENT]
[INDENT]next[/INDENT]
next
Regards
Re: Winsock - problem sending a large amount of data
Placing a DoEvents after each senddata has worked for me in the past.
Also, might I suggest using SetPixelV and GetPixel API's in place of pset and point. There's an incredible performance increase.
Hope this helps.