TCPObject and FileObjects
by Jookia · in Torque Game Engine · 07/20/2007 (10:39 pm) · 4 replies
Alright, so I have one file, I'm trying to make an updater, the updater downloads a new DSO but instead of downloading it like it should be, it does it line by line. I'm doing it using a TCPObject and tried with a HTTPObject, both do the same thing. Any ideas?
About the author
#2
Hope that helps,
Note: The key 'f' is way too close to the key 'g'.
Edit: URL's.
07/23/2007 (7:42 am)
Buffer the output and write it to a file. This resource and this resource should help you as guides to do what you are trying to do. Streams like TCPObject and HTTPObject read the downloads line by line; allowing you to examine them, and if you want, start buffering them. Once the download has finished you can then go and write the buffer to a file.Hope that helps,
Note: The key 'f' is way too close to the key 'g'.
Edit: URL's.
#3
07/23/2007 (8:11 pm)
I don't have the engine to change it.
#4
1: Make the client (when the client enters the server browser or other online activity is initiated) automatically connect to the server and check for updates.
2: When this happens, the client will join the update server and the server will message the client to open a "download patch" dialog box on the client's side, which will contain a "Yes" button (which messages the server to send the file) and a "No" button (which disconnects the client).
3: If the client clicks the "Yes" button, the message to the server will be sent, and the client will go into a receiving state.
4: The server will then use a FileObject to read through the patch file and compile it into a long string, with lines separated by "/n" characters (new lines). (Also, the client checks the server periodically to make sure the connection is still good.)
5: Then the server will use the string functions to read 8 characters at a time (or something like that), and message the client with the string.
6: The client will add the new string section to a string buffer variable and message the server to send the next 8 characters (A variable will denote which 8-byte segment to send).
7: This continues until the server reaches the end of the file, at which point it sends the last bits of leftover string and a variable stating that the end-of-file has been reached.
8: The client then adds the last bit of the string and begins outputting the string to the client-side file using a FileObject, after which the CRC value of the file is sent back to the server and checked.
9: If the CRC values are equal, the server messages the client with the success, or if they are not, it sends a message stating that they are not equal, and the download file is scrapped.
10: The client then disconnects from the server, and continues where it left off.
I really didn't want to write the pseudocode for that on here. It's just too much.
07/31/2007 (3:24 pm)
This might help:1: Make the client (when the client enters the server browser or other online activity is initiated) automatically connect to the server and check for updates.
2: When this happens, the client will join the update server and the server will message the client to open a "download patch" dialog box on the client's side, which will contain a "Yes" button (which messages the server to send the file) and a "No" button (which disconnects the client).
3: If the client clicks the "Yes" button, the message to the server will be sent, and the client will go into a receiving state.
4: The server will then use a FileObject to read through the patch file and compile it into a long string, with lines separated by "/n" characters (new lines). (Also, the client checks the server periodically to make sure the connection is still good.)
5: Then the server will use the string functions to read 8 characters at a time (or something like that), and message the client with the string.
6: The client will add the new string section to a string buffer variable and message the server to send the next 8 characters (A variable will denote which 8-byte segment to send).
7: This continues until the server reaches the end of the file, at which point it sends the last bits of leftover string and a variable stating that the end-of-file has been reached.
8: The client then adds the last bit of the string and begins outputting the string to the client-side file using a FileObject, after which the CRC value of the file is sent back to the server and checked.
9: If the CRC values are equal, the server messages the client with the success, or if they are not, it sends a message stating that they are not equal, and the download file is scrapped.
10: The client then disconnects from the server, and continues where it left off.
I really didn't want to write the pseudocode for that on here. It's just too much.
Jookia