sending files via WinSock

Started by
7 comments, last by Mulligan 21 years, 7 months ago
If I want to send a file using WinSock, do I need to go through it bit by bit, sendinf dozens of messages, or is there an easier way?
Advertisement
What do you mean by "sending a file"? To retrieve a file from somewhere could be pretty easy. From who and what, to whom and what, and by which means is the file to be sent?
I have a server which needs to send a file called stars.dat to the client. There directly connected, is that enough information?
If you want to avoid the sending part, you could manage if you instead of "sending" the file, command the client to download it via HTTP. This assuming that you can install a web server (eg. apache) on that server. I don''t know exactly how, but I think Windows API should have some neat functions for retrieving a file via HTTP. No idea if this would work for your implementation, though. What sort of protocol do you have between the server and client?

(I''ll need to goto bed now, so hopefully someone else could help out)
for file trasfers I read 512 bytes, send it then teh next 512 bytes...
if critical data I send it 3 times(server encription keys)... then compaire if correct...
If you were MEANT to understand it, we wouldn't have called it 'code'
I think thats what I'm going to end up doing, thanks.
Is there a maximum number of bytes that can be send per 'send()'? You said 512, while I've always thought the max was 256. Could I do 1024 or 2048, or would that present a data loss problem?

[edited by - Mulligan on September 15, 2002 1:08:24 PM]
There''s no limit, but I''d suggest you use 1460 bytes since that is the size of a TCP/IP packet of data (1500 - 40 byte header)


University is a fountain of knowledge, and students go there to drink.
Larger packet have higher chance of packet loss. However smaller packet have higher overhead because each tiny little packet needs a header, and multiply by the number of packets you sent.....
"after many years of singularity, i'm still searching on the event horizon"
quote:Original post by Big B
There''s no limit, but I''d suggest you use 1460 bytes since that is the size of a TCP/IP packet of data (1500 - 40 byte header)


University is a fountain of knowledge, and students go there to drink.


Are you positive? Where did you find this out? I''d like to know.
daerid@gmail.com

This topic is closed to new replies.

Advertisement