in reply to Aci Base24-eps (on IBM AIX)

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.

Replies are listed 'Best First'.
Re^2: Aci Base24-eps (on IBM AIX)
by naija_coder (Initiate) on Mar 01, 2010 at 13:55 UTC
    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.

        Base24-eps data transmission is purely ASCII, but I dunno if there is any record length marker preceding the message, neither am I sure if there is any record length terminator after the message. I checked the manual and couldn't find either.

        Interestingly, WireShark was able to 'see' and parse the incoming B24-eps data while my own application was totally blind to it.

        Any ideas?

      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.
        Thanks BrowserUK, your code works like charm, however, I now have this knotty problem - socket headers. How can I force the socket NOT to send header information? The Base24-eps trace log is capturing the header info sent by the socket and junking my iso8583 messages. The socket headers are being sent by the socket captures the destination, my ip, sending port and other info.