Results 1 to 2 of 2

Thread: Send a file in blocks

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Posts
    7

    Send a file in blocks

    I'm sending a large file in blocks. When it gets to the client how do I write to the file? Do I open the file with a wrtie and then next time it gets called make sure it only appends?

    I'm sending the file using a byte array, but when I writing to the file I'm using a string from the winsock.GetData.

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    On the other side, after you get the string, convert it into a byte array, then stick it in the file.
    VB Code:
    1. 'assuming you had a binary file open with handle 1, and strData is the incoming data string
    2. Dim abyteBuffer() As Byte
    3. abyteBuffer = StrConv(strData, vbFromUnicode)
    4. Put #1, , abyteBuffer
    You'll probably want to have the file opened from outside the DataArrival event, and then close it when you're done, otherwise you'll have to track where the last file writing operation took place, reopen the file, and seek to that position before writing again.
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width