in reply to Re^2: Socket or not
in thread Socket or not

Sorry to waist your time.

You didn't waste my time. I was attempting to avoid wasting yours.

Programming, setting up, and maintaining, all the code, logistics and required security that sit behind your desired: "I wanted to make a batch file or a perl script that they could simply double click to run the conversion. " is a very involved process that would require you to learn substantially more about programming that you currently know.

And the main point is, what you want is actually quite easy to setup, quickly & securely, using the existing facilities of your OS. But programming it in Perl will require considerable effort.

If you are considering doing it in Perl in order to bypass some political barriers, then you should really think twice 10 times before going ahead.

Because, if by doing this, you are crossing some "political" boundaries, then it could very well end up being detrimental to your source of income and career. Especially if you get the hardest aspect of the task--security--wrong.

If you really insist on going ahead, then the simplest mechanism would be to create two directories below the current shared directory--say \\yourWorkstation\sharedspace\IN & \\yourWorkstation\sharedspace\OUT--and then you run--once at the beginning of each day or week--a simply script that monitors the IN directory, when it sees a file appear there, it runs the conversion process and writes the results to the OUT directory.

Now all your users have to do is upload the files to the IN directory, and then check the OUT directory to see when the converted files are ready.

But even this is not entirely trivial as your program will need to to not only detect when the files appear in the IN directory, but also wait until their upload is complete before starting to process them.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^4: Socket or not
by ahmad (Hermit) on Nov 25, 2010 at 02:45 UTC

    The IN & OUT shared directories looks a great idea

    And I guess the OP might check for fully uploaded files by requiring an md5 checksum for each uploaded file like 'filename.ext.md5' then all he does it comparing the values before processing.

      Nice idea++ Though I think that calculating and re-calculating an MD5 until you get a match might be rather expensive.

      A cheaper alternative would be to append the length of the file: filename.ext.123456. That way, a simple -s of the file will tell if it has been fully transferred.

      That would make the monitoring script very simple. All that would be needed is something like:

      #! perl -slw use strict; my $sharePath = '...'; while( 1 ) { for( glob $sharePath . "IN/*" ) { my( $filename, $expected ) = m[/([^/]+)\.(\d+)$]; if( $expected == -s ) { rename $_, "$sharePath/$filename"; system 1, qq[theProcessingScript.pl <$sharePath/$filename >$sharePath/OUT/$file +name]; } } sleep 1; }

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.