title: Socket communication over internet Perl
body: <p>How can I make sockets work over the internet?</p>
  
  <p>For a TCP server I have created a socket in local IP and I set up port forwarding from the router.</p>
  
  <p>For the client I gave the router's IP address as <code>PeerAddr</code> (peer address). When starting the client from remote computer it's not working.<br><br>
  ~Sorry, i am clear now and below is the snippet~ <br>
  <strong>UPDATED:</strong>
  Server Snippet:</p>
  
  <pre><code>$server_socket = new IO::Socket::INET (
                       LocalHost =&gt; '192.168.0.4',
                       LocalPort =&gt; '1080',
                       Proto     =&gt; 'tcp',
                       Listen    =&gt; 300,
                       Reuse     =&gt; 1,
                       Type      =&gt; SOCK_STREAM,
                   )
                     or die "ERROR in Socket Creation: $!\n";
  </code></pre>
  
  <p>Client Snippet:</p>
  
  <pre><code>my $socket = IO::Socket::INET-&gt;new (
                   PeerHost =&gt; '117.97.148.228',# router ip example
                   PeerPort =&gt; '1080',
                   Proto    =&gt; 'tcp',
               );
  </code></pre>
  
  <p>What am I missing?</p>