Results 1 to 6 of 6

Thread: Fetch large data with GetData, mswinsck.ocx

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    Virginia, US
    Posts
    2
    I am trying to receive a large block of data, but
    it never seams to be larger than 512bytes when
    received.

    Im working on a server that uses mswinsck.ocx, and
    the client is passing a simple text file that has
    a binary file embedded (attachment) in it using
    Base64 (Or UU). The sent text document should
    be at least 64K, since the attached graphic is at
    least that large. However, when I open to write
    the file or get a Len, what was received is only
    512bytes. Ive never seen this happen before, maybe
    I need to do something different?

    This is just a snippit, but shows the general
    operation:

    winsock(index).ReceiveData

    dim InBuffer as string

    winsock(1).GetData InBuffer

    open "c:\test.msg" for output as #1
    print #1, InBUffer
    Close #1

    test.msg is only 512bytes, and also len(InBUffer)
    returns 512!

    Any ideas anyone? I need InBuffer to be a string,
    since I will be doing some string manipulation
    with it, I have to parse some headers from it, as
    this is an NNTPd in development, and the newsgroup
    the message belongs in, etc.. is in the message.

    Thanks,
    Andrew
    "I like to do what others say cant be done... Not to prove them wrong, but to prove me right!"

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    I'm not familiar with the ReceiveData method and could not find it searching the MSDN site.

    I'm curious about your indices. Does index = 1 in the following?
    winsock(index).ReceiveData

    dim InBuffer as string

    winsock(1).GetData InBuffer
    Is this code in your DataArrival routine and, if so, what is the value of bytesTotal?

  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Maybe you must send the file in pieces of 512 bytes.
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Or perhaps 512 bytes is the default if you don't specify the number of bytes in the GetData call. Just a guess as I have never tried to retrieve data with specifying the length.

  5. #5
    Lively Member
    Join Date
    Jan 1999
    Location
    Oshawa, Ontario, Canada
    Posts
    88
    um....I'm working on two programs write now...a client and a server.....the problem i'm having is getting the server to host multiple clients connected to it....if you could help me out with that, it would be great.

    but for your problem what you should do is if the file is bigger than the variable can hold just put all the information from the variable into a file everytime it gets full and keep doing it untill the file is complete.

    -knight
    -icq 17743984

  6. #6
    Guest

    Exclamation !!!

    Your receive code:

    Code:
    winsock(index).ReceiveData 
    
    dim InBuffer as string 
    
    winsock(1).GetData InBuffer 
    
    open "c:\test.msg" for output as #1 
       print #1, InBUffer 
    Close #1
    Assumes that the sent file is all sent at once, however this is not the case when you use Winsock. When sending large files with Winsock you will find that the file is broken into smaller packets which are then individually sent. Thus, by writing to the file in output mode, the previously received data are wiped over by the new one, and eventually by the last packet.

    To solve the problem you can try to open the file in append mode (not sure if it'll work), or at the sending end break the file into your own little packets which have a predetermined size so that the receiving end will know what sized packets to expect.

    Sunny

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