First of all, I think it`s important to point out I`m no expert in VB. So bare with me.

I´m writting a code for a remote file manager. I`ve got the file transfer to work but my problem is in the explorer itself.

My basic idea is to have a FileListBox with all the files in the server side and, on request by the client, with a For i = 0 To Files1.ListCount - 1 make a run over each file and send them to the client. Then, on the client side, add each file name (separating them with a "|") one by one to a ListBox with a split function.

Here is the code:

Server Side:

Code:
Case "1"
    For i = 0 To Files1.ListCount - 1
        x = Files1.List(i) & "|" & x       
    Next i
Winsock1.SendData "File" & x
Client Side:

Code:
Case "File"
Y = Right(Y, Len(Y) - 4)

Dim fields() As String
fields() = Split(Y, "|")

For i = 0 To UBound(fields)
    List1.AddItem Trim$(fields(i))
Next
End If
First, I would like to point out:

*This might not the the most eficient way to achieve my objective, BUT I`m trying to learn and understand why the code is not working.

Now the questions:

1-Why do I get the last 96 characters from all the file names? (I am almost sure it has something to do with the buffer of the winsock)
2-I know a timer could fix this but, is it the only way?

Thank you in advance!