problem with using socket



Hi,all

I create a socket with this script and telnet into it with port
25,after that I got a 220 message successfully.But when i transfer
'EHLO' to the port,the script close connection.What's wrong with my
code?

thanks

the code is shown below:
====

use strict;
use IO::Socket::INET;

my $client;
my $input;

my $sock=IO::Socket::INET->new(
Proto=>'tcp',
LocalHost=>'localhost',
LocalPort=>25,
Listen=>100,
Reuse=>1
);

while ($client=$sock->accept())
{
$client->autoflush(1);

print $client "220 ESMTP Service Ready\r\n";

while ($input=<$client>)
{
if ($input=~/^EHLO/)
{
print STDOUT "EHLO received\n";
#error ocurred here,the data listed below can't be send.
print $sock "250-ESMTP service ready\r\n";
print $sock "250-AUTH LOGIN\r\n";
print $sock "250-SIZE 20971520\r\n";
print $sock "250 OK\r\n";
print STDOUT "250 sended\n";
}
}
}


====

.



Relevant Pages

  • Re: Sending Problem
    ... So if you telnet on port 25 to the ip of your public mx record and do ... an EHLO, does it list the maximum message SIZE? ...
    (microsoft.public.exchange.admin)
  • Re: ksh and telnet script
    ... Test one using port 22 - should succeed ... This port does successfully reply instantly to telnet though… ... When I run the script, successful connections are fine, ...
    (comp.unix.shell)
  • Re: A few questions, if somebody could please assist -ive been doing my head in to get my vba pr
    ... Dim c As String, wdth As Double ... as for telnet, I would look for a telnet program that can be scripted. ... spreadsheet the userform i have made runs from. ... script files like the ftp does and any telnt code i have seen has lost me ...
    (microsoft.public.excel.programming)
  • Firewall Rules Summary
    ... Subject: Firewall Rules Summary ... This script is provided "as is" with no implied warranty. ... this came from various howtos and articles on iptables that existed around ... #specific port denies>1024 tcp ...
    (Focus-Linux)
  • Re: reverse ssh
    ... > logged into either box) can use the tunnel for whatever connects to it. ... > I suggest you connnect back to your home system's 'sshd' port and then you ... > will have to satisfy the home box's login authorization to get access ... > password from your script. ...
    (freebsd-questions)