Announcement

Collapse
No announcement yet.

custom http port number

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

  • custom http port number

    hi all,
    am using http download function.

    HTTP.Download("http://www.mydomain.com/myfile.exe", "C:\\Downloads\\myfile.exe", MODE_BINARY, 20, 80, nil, nil, nil);

    but i need abiloty to choose a custom port for http that is chosen by the user
    i have a already a input text box which will grab the value input and store it as port
    im trying to concatenate it into the function. see below.
    it may be just a simple syntax error on my end

    HTTP.Download("http://www.mydomain.com/myfile.exe", "C:\\Downloads\\myfile.exe", MODE_BINARY, 20, "..Port..", nil, nil, nil);

    any ideas?

    thanks'

  • #2
    Use

    Code:
    HTTP.Download("http://www.mydomain.com/myfile.exe", "C:\\Downloads\\myfile.exe", MODE_BINARY, 20, Port);
    or better yet

    Code:
    local nPort = String.ToNumber(Input.GetText("Input1"));
    if (nPort > 0) then
       HTTP.Download("http://www.mydomain.com/myfile.exe", "C:\\Downloads\\myfile.exe", MODE_BINARY, 20, nPort);
    else
       -- show an appropriate error message via Dialog.Message()
    end
    Ulrich

    Comment


    • #3
      This worked great,
      thanks ulrich

      Comment


      • #4
        Originally posted by dalygav View Post
        "..Port.."
        Your problem though was that you was passing the port option as a string anything wrapped in "" = string so you was telling the function to pass ..Port.. not what ever the port number was, there was no need for the ".. or .." parts when you was passing the port already in a reset prefix.

        Hope that explains where you went wrong.
        Plugins or Sources MokoX
        BunnyHop Here

        Comment


        • #5
          it does yes,
          thank you

          Comment

          Working...
          X