Winsock Control and Dynamic Array

Posted on 2003-03-25
Medium Priority
Last Modified: 2013-11-13
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?
Question by:skhan22
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 8206856

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,



Accepted Solution

bukko earned 150 total points
ID: 8206869

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) )




Author Comment

ID: 8206954
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.


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.

Author Comment

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

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question