Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi There, I have a client server application in which client sends a input file to server ,server uses a tool called abc.exe on that input file, which gives an output file and sends it back to client.The name for the output file is basically output_input file.if the output file with the same name is already present then it increments the suffix at each run. I have written this code but its not working correctly.I guess there is some problem with the $abc_cmd.Can anyone tell me what I am doing wrong?

# Read the signing image_type from the client app via the sock +et $image_type = <$client_socket>; chop($image_type); # Setup some default filenames and command strings. my $unsigned_file = "unsigned.bin"; my $signed_filename; my $output_file = "signed.$unsigned_file"; my $rcv_filesize; my $hsm_cmd; my $buf; my $error = "ACK\n"; $rcv_filesize = 0; my $i = 1; while (-e $output_file) { $output_file = "output.$input_file$i"; $i++; } $abc_cmd = "abc.exe" -i $input_file -o $output_file"; print $client_socket "ACK\n"; system $abc_cmd; # Run the command print "DONE\n"; # Open the file for reading open(INFILE, $output_file) || die "ERROR: Could not open out +put_file for reading!\n"; binmode INFILE; { local $/; $output_data = <INFILE>; } close(INFILE); print "$prefix Sending $output_file to the client... "; $client_socket->write($output_data, length($output_data)); print length($output_data), " bytes: DONE\n"; $client_socket->close(); print "$prefix Socket closed, operation completed!\n";

In reply to Access an executable from perl script by abcdefg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-23 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found