Announcement

Collapse
No announcement yet.

Hang the program when sending data to the server

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hang the program when sending data to the server

    Hang the program when sending data to the server


    Hello dear

    I noticed that when I use the Post or Get function data transfer to the server, the program stops and the program stops until the end of receiving the data.


    Can this regiment be prevented ?!
    Thanks for any suggestions

  • #2
    show us the http action

    Comment


    • #3
      HTTP.Submit(myurl,mydata,method, 20,80)

      Comment


      • #4
        did the link start with http or https ?

        Comment


        • #5
          Originally posted by startup View Post
          did the link start with http or https ?
          The link is http

          Comment


          • #6
            Depending the amount of data your sending and the way the server access it's requests it might need a header from a browser to work right but also will depends on what other things you have like timers in the background and your internet connection, AMS is single threaded and lock up's like this will happen.
            Plugins or Sources MokoX
            BunnyHop Here

            Comment


            • #7
              Originally posted by kingzooly View Post
              Depending the amount of data your sending and the way the server access it's requests it might need a header from a browser to work right but also will depends on what other things you have like timers in the background and your internet connection, AMS is single threaded and lock up's like this will happen.
              My data is a set of numbers that do not exceed 10 digits ... can not be reduced ?! If the user clicks at this time, the program will stop, but this is not a problem in other programs, including the browser!​​​​​​

              Comment


              • #8
                Well this is kinda not true many single thread apps do, do this and will off load this task to other things, but I don't use AMS's http function I used a 3rd party http tool like wget or curl and this will take the handling away. AMS as always had it's limits and depending on your pc, internet connection it will sadly lock up, I always hard this problem with HTTP in ams
                Plugins or Sources MokoX
                BunnyHop Here

                Comment


                • #9
                  Thanks can you please explain more about 3rd Party http?!

                  Comment


                  • #10
                    Rather then using the http commands you use a 3rd party tool like wget and you send the information from AMS to it via arguments via the File run option

                    Function:
                    Code:
                    function Wget(sURL, tArguments, sUserAgent)
                    local ArgumentsString = "";
                    for K, V in pairs(tArguments) do
                    if (ArgumentsString == "") then
                    ArgumentsString = "?"..tostring(K).."="..tostring(V);
                    else
                    ArgumentsString = ArgumentsString.."&"..tostring(K).."="..tostring(V );
                    end
                    end
                    File.Run(__RootFolderName.."\\Docs\\wget.exe", "-q -U \""..sUserAgent.."\" -O \""..FolderPath.."\\kfa\\~kfa.temp\" \""..sURL..ArgumentsString.."\"", "", -1, true);
                    if (File.DoesExist(FolderPath.."\\kfa\\~kfa.temp")) then
                    LoadToMemory = TextFile.ReadToString(FolderPath.."\\kfa\\~kfa.tem p");
                    File.Delete(FolderPath.."\\kfa\\~kfa.temp", true, true, true);
                    return LoadToMemory;
                    else
                    return false
                    end
                    end
                    This is a old function used in a old anime tool I created with the drive from Shadow, kinda miss that dude around here but this as been used in my tools that need http access what does not return just a normal web page.


                    Usage:
                    Code:
                    local API = {Post = "URL"}
                    local Arguments = {page="one",option="this"}; -- eg ?page=one&option=this
                    local UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6";
                    local Return = Wget(API.Post, Arguments, UserAgent);
                    you will have to get your own version of wget to use this and put it in your Docs folder
                    Plugins or Sources MokoX
                    BunnyHop Here

                    Comment


                    • #11
                      Originally posted by kingzooly View Post
                      Rather then using the http commands you use a 3rd party tool like wget and you send the information from AMS to it via arguments via the File run option

                      Function:
                      Code:
                      function Wget(sURL, tArguments, sUserAgent)
                      local ArgumentsString = "";
                      for K, V in pairs(tArguments) do
                      if (ArgumentsString == "") then
                      ArgumentsString = "?"..tostring(K).."="..tostring(V);
                      else
                      ArgumentsString = ArgumentsString.."&"..tostring(K).."="..tostring(V );
                      end
                      end
                      File.Run(__RootFolderName.."\\Docs\\wget.exe", "-q -U \""..sUserAgent.."\" -O \""..FolderPath.."\\kfa\\~kfa.temp\" \""..sURL..ArgumentsString.."\"", "", -1, true);
                      if (File.DoesExist(FolderPath.."\\kfa\\~kfa.temp")) then
                      LoadToMemory = TextFile.ReadToString(FolderPath.."\\kfa\\~kfa.tem p");
                      File.Delete(FolderPath.."\\kfa\\~kfa.temp", true, true, true);
                      return LoadToMemory;
                      else
                      return false
                      end
                      end
                      This is a old function used in a old anime tool I created with the drive from Shadow, kinda miss that dude around here but this as been used in my tools that need http access what does not return just a normal web page.


                      Usage:
                      Code:
                      local API = {Post = "URL"}
                      local Arguments = {page="one",option="this"}; -- eg ?page=one&option=this
                      local UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6";
                      local Return = Wget(API.Post, Arguments, UserAgent);
                      you will have to get your own version of wget to use this and put it in your Docs folder
                      Hello!

                      Thank you very much ...

                      Can you give me a source?

                      For example to this address:


                      Give a request and save the return value in the time variable (method: get, data: 1, timeout:20, port:80, result variable: time)?

                      and can you please explain about this code:


                      Code:
                      local Arguments = {page="one",option="this"}; -- eg ?page=one&option=this
                      local UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6";
                      if the user doesn't have firefox ,this is work correct?



                      thanks in advace...

                      Comment


                      • #12
                        That line isn't telling you that you need firefox this is telling the server your talking to that it's using FireFox a the User Agent so the server will return the information some servers will not return data if it's been called via a program or api calling from a none browser, this sends the User Agent data to fool a server to think the call came from a browser so no you don't need any browser installed.

                        That host this you just posted is crap after refeshing the page 3 times I got this
                        This site/page has used all avaialble php / apache processes allowed on free hosting account.

                        Refreshing the page once the amount of apache / php processes are reduced will cause the site to work

                        We would recommend upgrading your hosting account at IFastNet Premium hosting accounts , premium hosting accounts have MUCH higher resources dedicated to them.

                        Code:
                        local API = {Post = "[URL]http://sinadehghani.gigfa.com/HightScores/time.php[/URL]"}
                        local Arguments = {i="1"};
                        local UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"; local Return = Wget(API.Post, Arguments, UserAgent);
                        
                        local wReturn = Wget(API.Post, Arguments, UserAgent);
                        
                        Dialog.Message("", wReturn);
                        You will also have to made a code change to the function as my app already created all the needed folders for the return

                        Code:
                        function Wget(sURL, tArguments, sUserAgent)
                        local ArgumentsString = "";
                        for K, V in pairs(tArguments) do
                        if (ArgumentsString == "") then
                        ArgumentsString = "?"..tostring(K).."="..tostring(V);
                        else
                        ArgumentsString = ArgumentsString.."&"..tostring(K).."="..tostring(V );
                        end
                        end
                        File.Run(__RootFolderName.."\\Docs\\wget.exe", "-q -U \""..sUserAgent.."\" -O \""..__RootFolderName.."\\Docs\\~kfa.temp\" \""..sURL..ArgumentsString.."\"", "", -1, true);
                        if (File.DoesExist(__RootFolderName.."\\Docs\\~kfa.temp")) then
                        LoadToMemory = TextFile.ReadToString(__RootFolderName.."\\Docs\\~kfa.tem p");
                        File.Delete(__RootFolderName.."\\Docs\\~kfa.temp", true, true, true);
                        return LoadToMemory;
                        else
                        return false
                        end
                        end
                        Also remember you must download wget your self and put it in your Doc folder of your AMS app

                        Windows version of wget, the non-interactive download tool



                        Plugins or Sources MokoX
                        BunnyHop Here

                        Comment


                        • #13
                          Originally posted by kingzooly View Post
                          That line isn't telling you that you need firefox this is telling the server your talking to that it's using FireFox a the User Agent so the server will return the information some servers will not return data if it's been called via a program or api calling from a none browser, this sends the User Agent data to fool a server to think the call came from a browser so no you don't need any browser installed.

                          That host this you just posted is crap after refeshing the page 3 times I got this


                          Code:
                          local API = {Post = "[URL]http://sinadehghani.gigfa.com/HightScores/time.php[/URL]"}
                          local Arguments = {i="1"};
                          local UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6"; local Return = Wget(API.Post, Arguments, UserAgent);
                          
                          local wReturn = Wget(API.Post, Arguments, UserAgent);
                          
                          Dialog.Message("", wReturn);
                          You will also have to made a code change to the function as my app already created all the needed folders for the return

                          Code:
                          function Wget(sURL, tArguments, sUserAgent)
                          local ArgumentsString = "";
                          for K, V in pairs(tArguments) do
                          if (ArgumentsString == "") then
                          ArgumentsString = "?"..tostring(K).."="..tostring(V);
                          else
                          ArgumentsString = ArgumentsString.."&"..tostring(K).."="..tostring(V );
                          end
                          end
                          File.Run(__RootFolderName.."\\Docs\\wget.exe", "-q -U \""..sUserAgent.."\" -O \""..__RootFolderName.."\\Docs\\~kfa.temp\" \""..sURL..ArgumentsString.."\"", "", -1, true);
                          if (File.DoesExist(__RootFolderName.."\\Docs\\~kfa.temp")) then
                          LoadToMemory = TextFile.ReadToString(__RootFolderName.."\\Docs\\~kfa.tem p");
                          File.Delete(__RootFolderName.."\\Docs\\~kfa.temp", true, true, true);
                          return LoadToMemory;
                          else
                          return false
                          end
                          end
                          Also remember you must download wget your self and put it in your Doc folder of your AMS app

                          Windows version of wget, the non-interactive download tool


                          Thank's for your answer...

                          I try this way...

                          Comment

                          Working...
                          X