[Tn5250j-general] Re: Tn5250j-general digest, Vol 1 #767 - 4 msgs

2005-03-16 Thread Tara Hunter
Kenneth,
 
You are correct, I am using the underlying api to send characters and get responses. My test code listed below pretty much sums it up - the only other key method call is sendKeys in the Screen5250 class (reference obtained from Session5250.getScreen() ) and I've built a number of convienience methods similar to the waitForTextInScreen listed below - all built around Screen5250.getScreenAsChars(). 
 
With respect to your question about whether the connections are actually being terminated - any suggestions on how to verify that would be appreciated. I do not have anything but user interface access to the AS400 machine I am accessing. I did run lsof while my process was running which will show file descriptors and connections as they are being made and dropped - it looked to me that the sockets were going away as expected and I never had a problem getting a new socket - but the input stream was at an end of file after a number of successful connections. The error message was being generated by the tnvt.readNegotiations method as a result of receiving a -1 from bin.read()
 
As for my original problem, I finally came to roughly the conclusion you outlined here - it is the fault of the Sun 1.3.1_08 jvm running on Linux (I modified several things in the TN5250J codebase to move backwards to 1.3 because an upgrade at this time would just be too involved). Although, I did do a quick upgrade to 1.4 with just my test class to see if it would relieve the problem and it did not - made it worse if anything. I took this back to my client and managed to find a Sun box to run on - thus avoiding the problem. I will cycle back around when things ease up a little.
Test code is listed below for reference, but like I say, it's a non issue at this point and I don't think the fault lies within the TN5250J codebase. I really appreciate your response. 
 
Regards,
Tara
 
Test code:
 
import org.tn5250j.beans.ProtocolBean;import org.tn5250j.Session5250;import org.tn5250j.framework.tn5250.Screen5250;
import org.apache.log4j.BasicConfigurator;
 
public class My5250Test {
  private Session5250 session;  private ProtocolBean pb;  private int lenScreen;  private Screen5250 screen;
  My5250Test() throws Exception {    BasicConfigurator.configure();
    ProtocolBean pb = new ProtocolBean("TestConnect", "TestConnect");    pb.setHostName("");
    for (int n=0; n<=200;n++) {  session = pb.getSession();  screen = session.getScreen();  if (!session.isConnected()) {    System.out.println("connecting - n = " + n);    pb.connect();    waitForTextInScreen("Password", 5000);  }
  if (session.isConnected()) {    session.disconnect();    System.out.println("Moving on...");  }  else {    System.out.println("connection failed!");  }    }  }
  public void waitForTextInScreen(String searchString, int timeout) throws Exception {    int increments = timeout/200;    int i = 0;    boolean found = false;    char[] screenChars = null;    String screenString = null;    while (i <= increments && !found) {  screenChars = screen.getScreenAsChars();  screenString = new String(screenChars);  if (screenString.indexOf(searchString) >= 0) {    found = true;  }  else {    i++;    waitFor(200);  }    }    if (found)
 {  //a little extra time to allow the screen to finish loading - will save a lot of grief  waitFor(200);    }    else {  //throw timeout exception    }  }
  public void waitFor(int time) {    try {  Thread.sleep(200);    }    catch (InterruptedException ex) {}  }
  public static void main(String[] args) {
    try {  My5250Test myTest = new My5250Test();    }    catch (Exception e) {  e.printStackTrace();    }  }}
 
 
 
 
 
Message: 1Date: Mon, 14 Mar 2005 09:18:24 +0100From: Kenneth Pouncey <[EMAIL PROTECTED]>To: tn5250j-general@lists.sourceforge.netSubject: Re: [Tn5250j-general] IOException on LinuxReply-To: tn5250j-general@lists.sourceforge.netRoyI think here Tara is using the underlying api for the tn5250j project in aprogram to do a signon and then execute the commands she needs. She can thenselect what to do by reading the responses back from the screens and checkingfor specific data. Kind of like what Patrick was doing with his printer manager.Probably a little more involved than that but the concept is the same. I dobelieve there is sample code out there in the project cvs that shows this beingdone.Tara> > I've written a little test code that simply connects and signs in then> > disconnects repeatedl
 y. Once
 the exception occurs, the process is> > unsuccessful in establishing any more connections. However, I can> > restart my test app and it will connect successfully for a period of> > time (typically 50-60 times though I've seen as low as 10) and then> > quit again. I am not sure about this problem could you send me your code bit and I can maybetest it. You mention that it works on a sun system without a hitch so

[Tn5250j-general] Issue with BREAK messages

2005-03-16 Thread Richard Houston
Hey Kenneth,

Here is another old bug we reported and not real sure if it was fixed.

Let me know if you need more info.





 Original Message 
Subject: [Tn5250j-general] Issue with BREAK messages
From:"Richard Houston" <[EMAIL PROTECTED]>
Date:Tue, August 17, 2004 10:09 am
To:  tn5250j-general@lists.sourceforge.net
--

Hi all,

One of the programmers has found an interesting little issue. I ma not a
400 person so I will paste it in below verbatim.

Let me know if you need anymore info.

"Hi Rich,
I quite by accident found another problem... (Kinda big problem).

It seems that when a program fails, and attempts to send a message
back to the screen, it doesn't do anything.  The session stays as locked
to activity, and would run forever (you have to actually at least until
you end the job).   The message type I invoked was a CPF message but I
have a feeling it will happen with other messages as well.  Normally the
program waits until you enter in the option you want the system to take (C
G S D or F), but since the message was not sent anywhere, there was no way
to respond to the message, so the program continued to sit
there.  The program should have sent the message to the jobs message queue
as a *BREAK type and provided a place for the reply (see page 3). Pages 1
and 2 are how it worked on my machine.  I tried the exact same thing on
one of the regular users machine (signed on as myself) and the message
popped up the way it is suppose to.

Also, when this happens, the system request process doesn't work.  I
called up system request and put in a 2 to end the job and it didn't do
anything, job still remained there. Then I tried a 1 to call up an
alternate session and nothing happened.  It's possible the 2 are
connected because I got Arnel to try the SysReq when it wasn't in this
stuck mode and it worked as expected.

If you need more info, let me know.
Thanks, Lori"



Regards,
+--+
| Richard Houston  .^. |
| R.L.H.  Consulting   /V\ |
| E-Mail  <[EMAIL PROTECTED]>/(   )\   |
| WWW   ^^-^^|
+--+


pdf_nbsp_attachment
Description: Binary data