Link to home
Start Free TrialLog in
Avatar of skhan22
skhan22

asked on

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
Avatar of bukko
bukko


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

ASKER CERTIFIED SOLUTION
Avatar of bukko
bukko

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
Avatar of skhan22

ASKER

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
Avatar of skhan22

ASKER

Thanks bukko for your help. your answer above helped me out with solving my problem.