I want to create a socket to a server and get data on that socket using perl, following is my script:
my $sock = new IO::Socket::INET
PeerHost => 'xxx.xxx.xxx.xxx',
PeerPort => 23,
Proto => 'tcp'
die "Socket could not be created. $!\n" unless $sock;
$usr = substr $str,1,8;
$usr = "myusername";
$pswd = substr $str,1,8;
$pswd = "mypassword";
close ( $sock );
All I get is the result: "Authorization failed", which means "myusername" and "mypassword" are not correctly read by the socket (if I enter them from cmd line, they work well).
I tried "myusername\n", "myusername\r\f", they are failed as well.
But when I write VBscript with "myusername" + vbcrlf
it works. (vbcrlf means clear character and linefeed character in VB)
That's very strange, please help.