Read will block indefinitely as long as socket is in the correct state. I'm suggesting the socket is not in the correct state. 5250 stream (and I think TN5250 merely extends 5250) will have turned the state around after sending the readMDT command. 5250 is a synchronous half duplex protocol. In other words the socket is no longer "open" after the readMDT is sent.
ENQ's, ACK's and NAK's are there in Ethernet, IP, TCP communications as well as TwinAx. The socket protocol hides it all from your application. You should see them in a WireShark trace.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of James H. H. Lampert
Sent: Friday, May 17, 2013 6:49 PM
To: Midrange Systems Technical Discussion
Subject: Re: New details, Re: Troubleshooting Telnet connections that drop for no apparent reason -- HELP?
On 5/17/13 3:29 PM, Dan Kimmel wrote:
-1 returned from read(byte[], int, int) doesn't mean an EOF character
was read. It means that the sequence of IP packets is done.
As I recall, when the 5250 controller sends a readMDT, it stops
sending and starts waiting for a response. It appears to me that the
behavior is as expected.
I think the error lies in trying to read again after the readMDT is
received.
So long as the socket remains open, the read on it does *not* return an EOF condition; it *blocks* until new bytes appear. Indeed, I have not, within recent memory, succeeded in *forcing* a TN5250 socket connection to EOF-out. Not by varying off the device, not by killing the connection from WRKCFGSTS, and not by physically unplugging the Ethernet cable. And yet for this one installation (and possibly only for certain users), it EOFs out for no apparent reason, and in the case of the most recent capture, it does so less than a second after sending a packet, after working perfectly for dozens, perhaps hundreds, of transmissions in both directions.
If it is as I suspect, the read after receiving readMDT is going to
send an ENQ and the 5250 controller will send back NAK as it is itself
waiting for data. As a matter of fact, the ENQ may be followed by an
ACK, as the receiver is expecting data and says "right, go ahead and
send", but your read never sends anything, so the receiver would time
out and start sending NAK's which may trigger the -1. Hard to tell as
there are so many layers of protocol involved.
That sounds like something specific to Twinax hardware polling. This is TN5250.
--
James H. H. Lampert
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.