Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mulligan

sending files via WinSock

This topic is 5757 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
I have a server which needs to send a file called stars.dat to the client. There directly connected, is that enough information?

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.....

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!