jlahowetz has asked for the wisdom of the Perl Monks concerning the following question:

I have been trying to get this program to work (code below). The idea of the code is to have a server program running on compA and a client program running on compB. CompB will ask compA for a txt file and compA will send it, simple enough. This process will be repeated over and over again until I manually close the client program on compB. The problems are 1)at line 7 on the server code I recieve an error stating; Error Sending Packet: Unknown Error. And 2) After 5 minutes or so the programs both close. This is not good and I'm not sure why they are doing so.
-------------------------------------------- SERVER CODE -------------------------------------------- use strict; use Net::FileShare; my ($fh) = Net::FileShare->new( _send_only => 1, _directory => 'C:\Documents and Settings\deadp +ickle\Desktop\UAV', _debug => 1); $fh->server_connection; --------------------------------------------- CLIENT CODE --------------------------------------------- use strict; use Net::FileShare; my ($fh) = Net::FileShare->new( _directory => 'C:\Documents and Settings\deadp +ickle\Desktop'); while ( -e 'C:\Documents and Settings\deadpickle\Desktop\UAVuavpositio +n.txt') { $fh->client_automated("localhost","3000","get","uavposition.txt" +); sleep 5; };

Replies are listed 'Best First'.
Re: Net::Fileshare Server/Client closing
by Khen1950fx (Canon) on Sep 08, 2006 at 11:52 UTC
    Two things came to mind when I read your post. First, it seems to me that there is file-sharing problem. If you're on Windows, then make sure that the files that you want to share are set up for file-sharing. Second, it seems to me that you're really trying to emulate a "service". You can set up a perl script to work as a sevice using Win32::Daemon and Win32::Daemon::Simple. See:

    Win32::Daemon

    Win32-Daemon-Simple