naija_coder has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Am working on interfacing an application to BASE24-eps running in IBM AIX. Am connected to the server through a LAN. The Base24-eps server is configured to send out echo messages at interval.

When I run the client, the BASE24-eps log shows that am connected.

When I run the server that should listen to the echo messages coming from the Base24-eps, the server simply wait until I kill it - returning 0 bytes (while the Base24-eps's log shows it has sent a lot of bytes)

In order to ascertain if the Base24-eps server was sending echo test messages, I designed a vb app with winsock control, when I ran the app I immediately received the echo test message.

My question is: Can Perl not handle Base24-eps data format? If it can, how should I go about coding my solution?

Thanks

Replies are listed 'Best First'.
Re: Aci Base24-eps (on IBM AIX)
by Corion (Patriarch) on Mar 01, 2010 at 12:58 UTC

    I guess you will have to show some code, because Perl is quite good at running TCP/IP networking stuff. Maybe you are Suffering from Buffering, in one way or the other.

      Hi Corion,

      My code snippets follows

      Client code snippet...

      $socket = IO::Socket::INET->new(PeerAddr => '77.77.77.77', PeerPort => 1500, Proto => 'tcp') or die "Couldn't connect to remote server\n";<br><br> $socket->autoflush(1);<br><br> .....<br><br> .....<br><br> my $tcpmessage = realencodeData($mti) . $PrimaryBitmapHex . $dataelem +ent . "\n";<br><br> $socket->autoflush(1);<br> print $socket $tcpmessage;<br> $socket->autoflush(1);<br><br><br><br><br>
      Server code snippet...

      # initialize host and port<br> $socket = IO::Socket::INET->new(Proto => 'tcp', LocalPort => 1500, Lis +ten => SOMAXCONN, ReuseAddr => 1, Reuse => 1) or die "Couldn't +connect to port:\n";<br><br> warn "Waiting for incoming connections on port 7535...\n";<br><br> while (!$quit)<br> {<br> $socket->autoflush(1);<br> next unless my $session = $socket->accept;<br><br> my $peer = gethostbyaddr($session->peeradd, AF_INET) || $session-> +peerhost;<br> my $port = $session->peerport;<br> warn "Connection from ($peer, $port)\n";<br><br> $session->autoflush(1);<br><br> while (<$session>)<br> {<br> $session->autoflush(1);<br> chomp;<br> print $_ . "\n";<br> parsemessage($_);<br> }<br> warn "Connection from ($peer, $port) finished\n"; close $session;<br> }<br><br> warn "Closing connection(s)...\n";<br><br>

        I'm unfamiliar with Base24-eps, is it ACSII based? I would think you have to determine the record terminator or record byte length.

        Try setting  $/ = \1;, that will cause your code to get 1 character at a time and at least show you that it is receiving something (or not).

        Once you see that you're receiving stuff, you can try adjusting it (say: $/ =\4;) and maybe it'll allow you to work out how the packets are delimited.

        Mind you, you ought to be able to work that out from the wireshark traces you mentioned.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Aci Base24-eps (on IBM AIX)
by Anonymous Monk on Jun 06, 2021 at 15:22 UTC
    I think the message is ISO8583