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: How to Create a TCP/IP PrinterPort on a MS Cluster 2k3 via Scr
    ... XP is not in the cluster so I'm not clear on the failure question. ... the user running the script should be admin on the remote print server. ... thus the creation of the port on the node. ...
    (microsoft.public.windows.server.clustering)
  • Re: How to Create a TCP/IP PrinterPort on a MS Cluster 2k3 via Scr
    ... XP is not in the cluster so I'm not clear on the failure question. ... the user running the script should be admin on the remote print server. ... thus the creation of the port on the node. ...
    (microsoft.public.windows.server.clustering)
  • 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)