'LinKin Posted April 9, 2014 Share Posted April 9, 2014 (edited) Hello, I've seen some posts talking about clients downloading stuff.. As I posted some time ago, I'm using fetchRemote server-side to download a char and then send it to the client. But, when more players requests a chart, the server starts to lag. (Because it's downloading the chars (which are different almost always)) Now, I've seen/readed about downloadFile coming with MTA 1.4 (If I'm not wrong). Would this function cause lag to the server? I rather that it causes lag to the client instead of causing lag to the whole server. Edited April 9, 2014 by Guest Link to comment
Baseplate Posted April 9, 2014 Share Posted April 9, 2014 I guess downloadFile won't cause any lag to the server but it may does for the client if his internet connection is total crap. Link to comment
'LinKin Posted April 9, 2014 Author Share Posted April 9, 2014 I hope it's like that Isn't there a way to make it like this but on the current MTA version? Link to comment
Arnold-1 Posted April 9, 2014 Share Posted April 9, 2014 Download File as far as i know, downloads things from the server it's connected to, so i don't thing the problem is going to be solved, i suggest you posting it on mantis, but before that, download the nightly build for MTA 1.4 and test download file, good luck in that. EDIT: since we posted in the same time, i'm gonna tell you to wait 1.4, it's coming soon. Link to comment
Gallardo9944 Posted April 10, 2014 Share Posted April 10, 2014 You can also create a php page on the same machine to read your chart or whatever and use fetchRemote clientside to your custom page so the server doesn't get affected as much. I have such php file: <?php $s = $_GET['s']; $js = get_web_page("https://internet.page/somepage.php?data=".$s); echo $js['content']; function get_web_page( $url ) { $user_agent='Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0'; $options = array( CURLOPT_CUSTOMREQUEST =>"GET", //set request type post or get CURLOPT_POST =>false, //set to GET CURLOPT_USERAGENT => $user_agent, //set user agent CURLOPT_COOKIEFILE =>"cookie.txt", //set cookie file CURLOPT_COOKIEJAR =>"cookie.txt", //set cookie jar CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; } ?> And just request if from the client with s parameter in. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now