Winsock Control and Dynamic Array

I am trying to develop an application that will send a dynamic array to the server to process the files. the app is client/server app and the server is listening on port 1007. i am using winsock control. the client downloads some files from the server and than it stores the file names in a dymanic array and than send the results to the server to move the files to the archive directory. i don't know how i can pass the results of dynamic array (arrayFiles()) to the server?
thanks
sk
skhan22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bukkoCommented:

Convert the array to a delimited string first, e.g.:

strCSV = Join( a_strMyArray, "," )

Then, when it is at the server end, convert it back into an array as follows:

a_strMyArray() = Split( strCSV, "," )

Obviously, you should choose a delimiter which would not normally appear in any of your array elements, such as Chr(31)

Hope it helps,

bukko

0
bukkoCommented:

In your case, this would be:

strFiles = Join( arrayFiles(), Chr(31) )
' then send string using winsock.

At the other end...

' get string using winsock, then:
arrayFiles() = Split( strFiles, Chr(31) )

Regards

bukko

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skhan22Author Commented:
thanks for your quick reply. let me as you this. what if i have the loop below

*** Loop on client to store the file names into array*****

sFile = Dir$("c:\*.txt") 'Get first entry
 
Do Until Len(sFile) = 0 'Loop until we run out (sFile will be empty)
  If Not sFile = "." And Not sFile = ".." Then
    ReDim Preserve sArray(i)
    sArray(i) = sFile   'Display what we found
    i = i + 1
  End If

  sFile = Dir$ 'Get next entry.
 
Loop

*******************************************************

After the above loop is done on the client. i want to send the results of variable i and sarray to the server and than let the server perform the loop below to get the file name and store it in strFile variable.

*** Loop on server to find the file names *****

For i = 0 To UBound(sArray) 'Now we have all the files in an array, so..
strFile = sArray(i)
Next i

************************************************

Any help of this would be greatly appreciated.
sk
0
skhan22Author Commented:
Thanks bukko for your help. your answer above helped me out with solving my problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.