IO::Socket::INET related question...

  • akaash
  • Beginner
  • Beginner
  • akaash
  • Posts: 62
  • Loc: Gujurat,India

Post 3+ Months Ago

Code: [ Select ]
sub pop_connect { #connect to pop server
 my ($popserver)=@_;
 my $remote;
 my $trash;

 eval('use IO::Socket; 1;') or error("no socket for checking mail");
 $remote = IO::Socket::INET->new(PeerAddr => "$popserver",
                 PeerPort => 'pop3(110)',
                 Proto  => 'tcp',
                 Timeout => 90);
 return "" unless ($remote);
 $remote->autoflush();
 $trash = <$remote>;
 if($trash=~/^\+OK/){return $remote;}

 return "";
}
  1. sub pop_connect { #connect to pop server
  2.  my ($popserver)=@_;
  3.  my $remote;
  4.  my $trash;
  5.  eval('use IO::Socket; 1;') or error("no socket for checking mail");
  6.  $remote = IO::Socket::INET->new(PeerAddr => "$popserver",
  7.                  PeerPort => 'pop3(110)',
  8.                  Proto  => 'tcp',
  9.                  Timeout => 90);
  10.  return "" unless ($remote);
  11.  $remote->autoflush();
  12.  $trash = <$remote>;
  13.  if($trash=~/^\+OK/){return $remote;}
  14.  return "";
  15. }


--------------
what is the meaning of:

1) $remote->autoflush();

2) $trash=<$remote>;
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • phpSelectah
  • Student
  • Student
  • User avatar
  • Posts: 97

Post 3+ Months Ago

1. Forces a flush on the output channel. ( the socket )

2. is copying the response header into a variable , and checking its status via a regular expression.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 136 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.