| View previous topic :: View next topic |
| Author |
Message |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Wed Apr 01, 2009 8:26 am Post subject: [C++] File transfer |
|
|
| What APIs do I use for creating file transfers? I can imagine using sockets, but do I literally send the file data over? There must be some kind of better method to doing it. I'm asking because I'm creating an auto-update for a program.
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Apr 01, 2009 9:12 am Post subject: |
|
|
Yes you literally send data over lol. ReadFile, and send. There might be an easier method. What do you want to send it over? Ftp? Http?
_________________
|
|
| Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Wed Apr 01, 2009 10:51 am Post subject: |
|
|
| TransmitFile() can be used to send files over winsock sockets. You can pass it the path of the file you want to send. I don't know about efficiency and I don't know if it checks if the data was send correctly (like a CRC check).
|
|
| Back to top |
|
 |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Wed Apr 01, 2009 11:51 am Post subject: |
|
|
| tombana wrote: | | TransmitFile() can be used to send files over winsock sockets. You can pass it the path of the file you want to send. I don't know about efficiency and I don't know if it checks if the data was send correctly (like a CRC check). |
Thank you. I'll try that tonight.
| lurc wrote: | | Yes you literally send data over lol. ReadFile, and send. There might be an easier method. What do you want to send it over? Ftp? Http? |
I'm going to use winsock for it. I can't believe you can actually literally send it over
|
|
| Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Wed Apr 01, 2009 1:25 pm Post subject: |
|
|
| Rembember that when you manually send the file over winsock you have to divide the file up into chunks of max 4 kb or so. Otherwise the winsock buffer can't hold the data.
|
|
| Back to top |
|
 |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Wed Apr 01, 2009 3:49 pm Post subject: |
|
|
| TransmitFile() doesn't require that, does it?
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Apr 01, 2009 4:24 pm Post subject: |
|
|
How else would you send it? And I suggest using TransmitFile if your a beginner with winsock. But if you know enough winsock I'm sure you can find a more efficient way.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Wed Apr 01, 2009 7:41 pm Post subject: |
|
|
| I think TransmitFile() is probably the best way to do it over winsock.
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Wed Apr 01, 2009 7:49 pm Post subject: |
|
|
if you upload the files to a server/website, you can download them using
URLDownloadToFile()
_________________
|
|
| Back to top |
|
 |
nwongfeiying Grandmaster Cheater
Reputation: 2
Joined: 25 Jun 2007 Posts: 695
|
Posted: Wed Apr 01, 2009 8:05 pm Post subject: |
|
|
| I could do that, but I probably won't. I like the idea of transferring from winsock better.
|
|
| Back to top |
|
 |
|