title: Giving error 'Error Bad file descriptor' during execution of Perl
body: <p><strong>[<em>Question Updated by following the commentator's comments</em>]</strong> When I am using the following command for executing prop.obj
  <strong>&quot;perl sendXssl.pl <em>hostname</em> <em>port</em> prop.obj&quot;</strong>, It is giving error as &quot;Error Bad file descriptor, ssl_error=SSL connect attempt failed at sendXssl.pl line 6&quot;.
  Please help me to solve this.
  My Perl program is given below...</p>
  <h1>Perl</h1>
  <pre><code>use IO::Socket::SSL qw( SSL_VERIFY_NONE );
  use strict;
  use warnings qw( all );
  $|=1;
  
  my $sock = IO::Socket::SSL-&gt;new(
   PeerHost =&gt; $ARGV[0],
   PeerPort =&gt; $ARGV[1],
   SSL_verify_mode =&gt; SSL_VERIFY_NONE)
   or die &quot;error=$!, ssl_error=$IO::Socket::SSL::SSL_ERROR&quot;;
  
  print $sock &quot;X&quot;;
  my $data ;
  my $file = $ARGV[2];
  open(my $fh,'&lt;',$file) or die &quot;Error 2 $!\n&quot;;
  {
   local $/;
   $data = &lt;$fh&gt;;
  }
  close($fh);
  
  my $pack = $data;
  print $sock $pack;
  </code></pre>
  <p>I created <strong>prop.obj</strong> object from the following java file</p>
  <h1>Java</h1>
  <pre><code>import java.io.FileOutputStream;
      import java.io.ObjectOutputStream;
      import java.util.Properties;
      
      public class PropertiesX {
      
          public static void main(String[] args) {
              try {
                  String[] s = new String[1];
                  s[0] = &quot;notepad.exe&quot;;
                  Properties p = new Properties();
                  p.put(&quot;commandArgs&quot;,s);
                  p.setProperty(&quot;parent&quot;, &quot;c:\\windows\\system32\\notepad.exe&quot;);
                  FileOutputStream fos = new FileOutputStream(&quot;prop.obj&quot;);
                  ObjectOutputStream oos = new ObjectOutputStream(fos);
                  oos.writeObject(p);
                  oos.close();
                  System.out.println(p.toString());
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
      }
  </code></pre>