Jump to content

fetchRemote in client-side


Vector

Recommended Posts

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
Link to comment
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

Link to comment

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...