I had much success using Net::Telnet to connect to a socket on a mainframe that delivered messages. Now that the mainframe had an upgrade and it seems to be sending EBCDIC rather than ascii. The mainframe people can't back out the change or figure out how to make the data be ascii again. I tried to adjust the Net::Telnet script to use a call to ebcdic2asciii found in Convert::EBCDIC. Of course nothing comes out or I wouldn't be writing. If I just telnet to the socket, I do see characters, weird ones of course. I assume I might be better off using IO:Socket::INET, but I am not sure how to make sure I stay connected unless the remote socket dies and how to tell I have 'enough' data that I can use ebcdic2ascii on. I simply want to print the incoming data to the screen. Here is telnet output, probably not useful, just showing there IS something.
Escape character is '^]'.
Here is my basic attempt, which connects but doesn't print anything.
$socket = new IO::Socket::INET (
PeerHost => '188.8.131.52',
PeerPort => '6106',
Proto => 'tcp',
) or die "ERROR in Socket Creation : $!\n";
print "TCP Connection Success.\n";
# read the socket data sent by server.
$data = <$socket>;
print "Received from Server : $data\n";
$data = ebcdic2ascii($data);
print "Received from Server after : $data\n";
Any ideas of what to try ?