in reply to Re: Net::FTP and Ports
in thread Net::FTP and Ports

Thanks for the feedback, my initial thought was that it's a socket de-allocation problem as well, but I'm struggling to replicate the problem.

The platform is Windows XP Professional, running Activestates' ActivePerl 5.6.1 Build 635. Net::FTP version is 2.65 which seems to be the newest available for this build. The whole lot is compiled into a free standing Win32 Service using Perl Dev Kit PerlSvc v3

Playing around testing, I've tried the Reuseport and Reuseaddr options, but these throw back a "Macro Not implemented" result, which makes sense if you think about it as the RFC's state that only one service can run on any given port at any time, and forcing ReUsePort would cause IO::Socket to re-allocate the port immediately (not just when it's been freed). Incidentally, by creating multiple instances of IO::Socket::INET, I've discovered that the max sockets I am allowed to create is 255. However, in testing by performing quick recursive FTP connects/lists/transfers/disconnects to a local FTP server I can't replicate the problem despite performing over 12,000 iterations in the space of a few minutes!

This leads me either to the conclusion that something in my production code isn't correctly de-allocating the ports - or the WinXP API is occasionally allocating me a port that it then allocates to someone else consecutively!

Any ideas...?

Replies are listed 'Best First'.
Re: Re: Net::FTP and Ports
by demerphq (Chancellor) on Feb 06, 2004 at 12:16 UTC

    To be honest my idea would be to just lose the service and change to a scheduled task. I have many scripts running now that basically do what you describe, but run as scheduled tasks and not as services, and they seem to work just fine. Unless there is a really good reason to run as a service (ive yet to hear one in my job but....) then setting up a repeating scheduled task (not using the at command but the scheduled tasks facility available through the control panel) should do you nicely.

    Beyond that anything I could offer would be completely off the top of my head conjecture and unlikely to be useful.
    :-(
    Sorry.


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi