News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Recv

Started by Kucki, December 20, 2006, 09:39:52 PM

Previous topic - Next topic

Kucki

Hello,

In my Programm, a Win32 Application, I use Winsocks to send a File from a Server(own coded) to a Client(own coded).
It works good when the file, which is sent, ist very small. But if i send a bigger File (for example: Filesize: 8000 bytes) ist didn't work.
I found the reason why.
The Recv function doesn't wait until it is complete recved.
It only recved 1024 first bytes(when i call "recv" again it recved the rest).
But i don't want to split this File.

Have you any Suggestions, how i can say "recv",that it should wait until he recved all?

P.S. Hope you can understand my English.


PBrennick

Kucki,
If you do not mind doing so, it might be helpful if you attach the project. What is happening is you are only sending one packet. Chances are, you already know the solution, you need to create a loop and continue sending packets until you are done.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

u

Make your socket "blocking", after you read these tutorials http://www.madwizard.org/view.php?page=tutorials.contents
Please use a smaller graphic in your signature.

Tedd

The file WILL be 'split' - this is how the internet works - you can not avoid this.
It is not difficult to allocate a large block of memory to save the file into (which you would do if you receive it all in one piece) and then recv the first piece at the start of this memory, then recv the next piece and save it directly after the previous piece, and recv again..... until you have received all of the file -- it will be stored as 'one piece.'

Winsock does buffer the pieces, so you 'could' wait a few minutes and then do the recv, hoping all the pieces have arrived by that time, but this is still not guaranteed to work every time - data sent over the network will be fragmented, deal with it :P
No snowflake in an avalanche feels responsible.