Jump to content

fetchRemote in client-side


Vector

Recommended Posts

Posted (edited)

Hi, I try to use fetchRemote in client-side but it doesnt work. in fact, it works when using fetchRemote in server-side

I used to think that this error is because of client or server version are below the minimum required version.

But I put this on the meta file, and stil the same error.

     client="1.3.2" server="1.3.0-9.03739"/>  

this works ->

--server-side

  
  fetchRemote("http://localhost/image.png",  
         function(data, errno)  
               if errno == 0 then outputChatBox("error downloading  image: " .. errno); return; end;  
               triggerClientEvent(root, "onFileDownload", root, "image.png", data); 
         end);   
  

-- client-side

  
      addEvent("onFileDownload", true);  
      addEventHandler("onFileDownload", root, 
              function(fileName, data)  
                    -- cache the data to a file .. 
                    local file;  
                    if not fileExists(fileName) then file = fileCreate(fileName);  
                    else file = fileOpen(fileName); end;  
                    fileWrite(file, data);  
                    fileClose(file);                    
  
                    -- do whatever with the file ...  
              end);  
  

this not work-> (value returned by fetchRemote -> error 1006)

--client-side

  
  fetchRemote("http://localhost/image.png",  
         function(data, errno)  
               if errno == 0 then outputChatBox("error downloading  image: " .. errno); return; end;  
               triggerEvent("onFileDownload", root, "image.png", data);  
         end);   
      addEvent("onFileDownload", false);  
      addEventHandler("onFileDownload", root, 
              function(fileName, data)  
                    -- cache the data to a file .. 
                    local file;  
                    if not fileExists(fileName) then file = fileCreate(fileName);  
                    else file = fileOpen(fileName); end;  
                    fileWrite(file, data);  
                    fileClose(file);                    
  
                    -- do whatever with the file ...  
              end);  
  

help please.

Edited by Guest

there are two kinds of people: those who know C++ and those who don´t. .)

Posted

From the wiki: Note: Client side function only works with the server the player is connected to

Use server IP or hostname of the server wich the client is connected to on client-side. Eg.:

fetchRemote("http://1.2.3.4/image.png",  
  

Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003

Posted

I tried to use server-ip like this "http://x.x.x.x/image.png" and doesn´t work.

and with a hostname like myserver.no-ip.org "http://myserver.no-ip.org/image" doesnt´work.

error 1006

there are two kinds of people: those who know C++ and those who don´t. .)

Posted
I tried to use server-ip like this "http://x.x.x.x/image.png" and doesn´t work.

and with a hostname like myserver.no-ip.org "http://myserver.no-ip.org/image" doesnt´work.

error 1006

As csiguusz said, fetchRemote on the client side will only work to connect to the server. You cannot connect to servers that aren't hosted on the servers computer

Posted

the server i try to connect to is the same server the client is connected to in MTA.

there are two kinds of people: those who know C++ and those who don´t. .)

Posted

Well, for what it seems is that the IP you entered is not allowed.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...