Link to home
Start Free TrialLog in
Avatar of yongyih
yongyihFlag for Malaysia

asked on

Help me to solve this winsock problem.

I try to do a program for sharing file.  I need to send a list of file name (string) to remote pc.

file is a fileListBox
this is my loop to send data.

For c = 0 To file.ListCount
  winsockBrowse.SendData "<File>" & file.List(c)
  DoEvents
  msgbox "Pause"
Next c

The other side will received these data and add to a list box.

My problem is the data didn't add properly to list box.
something like this happen..
<File>c:\a.txt
<File>c:\b.txt<File>c.txt<File>d.txt......
<File>c:\z.txt

if i put a message box in the loop, then everything is ok.
How to solve this problem?
Avatar of priya_pbk
priya_pbk

try 'sleep' instead of msgbox

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

'and write this in place of msgbox
sleep(2000) 'sleeps for 2 sec

Hope this helps!

-priya
how abt sending the fileListbox values in an "Array". This way you won't require a loop while sending data. Just send the array with values.

-priya
ASKER CERTIFIED SOLUTION
Avatar of Julian_K
Julian_K
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To: priya_pbk
Sending directly an array... it may become too complicated, because the mscomm control maintains only binary and string. There will be conversions, that may lead to unwanted results. Pausing after each chunk of data is also not a good idea. This may take hours on a long list.
Avatar of yongyih

ASKER

Thank you for your help.
priya_pbk also can solve my problem but performance very slow.