AS/400 connectivity using java by jt400 api

I am making a project on Java Swing. I am having an AS/400 machine i am saving the spool files on AS/400 Machine as .txt and accessing it from a remote Windows Machine. I have made an UI to connect it to the AS/400 machine using JT400 API's. I am having 300 spool files(.txt) in the library on AS/400 machine. I m accessing this library to get the list of spool files basically .txt files. Now I am using JT400 OpenAsynchronously method but the program gets hanged over there and displays on 25 files. I don't know what to do please help
Akhil
Code:--------------------------------------------------
public Vector listSpooledFiles()
Vector rowData = new Vector();
// this.printQue = printQue;
try
String strSpooledFileName;
boolean fCompleted = false;
int listed = 0, size;
System.out.println(" inside method....1");
//System.out.println("Now receiving all spool files synchrously");
SpooledFileList splfList = new SpooledFileList(as400);
splfList.setUserFilter(userId);
//if((printQue.equalsIgnoreCase("*ALL"))||(printQue.equals("")))
//if((printQue.equalsIgnoreCase("*ALL")))
splfList.setQueueFilter("/QSYS.LIB/%ALL%.LIB/%ALL%.OUTQ");
// else
//splfList.setQueueFilter("/QSYS.LIB/%LIBL%.LIB/"+printQue+".OUTQ");
//splfList.setQueueFilter("/QSYS.LIB/%LIBL%.LIB");
// wait for the list to complete
//splfList.waitForListToComplete();
// add the listener.
System.out.println(" inside method....2");
splfList.addPrintObjectListListener(this);
System.out.println(" inside method....3");
// open the list, openAsynchronously returns immediately
splfList.openAsynchronously();
System.out.println(" inside method....4");
do
System.out.println(" inside do....1");
// wait for the list to have at least 25 objects or to be done
waitForWakeUp();
System.out.println(" inside method....1.2");
fCompleted = splfList.isCompleted();
System.out.println(" inside method....1.3");
size = splfList.size();
System.out.println(" inside method....1.4");
System.out.println(size+"::size of files");
//System.out.println("sizeOfList......"+size);
// output the names of all objects added to the list
// since we last woke up
while (listed < size)
System.out.println(" inside method....1.5");
if (fListError)
System.out.println(" ..Exception on list - " + listException);
break;
System.out.println(" inside method....1.6");
SpooledFile splf = (SpooledFile)splfList.getObject(listed++);
} while (!fCompleted);
System.out.println(size+"::Size");
//splfList.removePrintObjectListListener(this);
System.out.println(" inside method....1.7");
Enumeration enum = splfList.getObjects();
System.out.println(" inside method....1.8");
while(enum.hasMoreElements())
SpooledFile splf = (SpooledFile) enum.nextElement();
if(splf != null)
Vector tmp = new Vector();
String fileName = splf.getStringAttribute(SpooledFile.ATTR_SPOOLFILE);
int fileNo = splf.getNumber();
String jobName = splf.getJobName();
String jobUser = splf.getJobUser();
String jobNo = splf.getJobNumber();
Integer page =splf.getIntegerAttribute(SpooledFile.ATTR_PAGES);
String date=splf.getStringAttribute(SpooledFile.ATTR_DATE);
String time=splf.getStringAttribute(SpooledFile.ATTR_TIME);
date=date.substring(1);
StringBuffer sbdate= new StringBuffer(date);
sbdate=sbdate.insert(2,"/");
sbdate=sbdate.insert(5, "/");
StringBuffer sbtime=new StringBuffer(time);
sbtime=sbtime.insert(2,":");
sbtime=sbtime.insert(5,":");
date=sbdate.toString();
time=sbtime.toString();
if((!fileName.equals("QPJOBLOG")) && (!fileName.equals("QPDSPJOB")) && (!fileName.equals("QPSRVDMP")))
// For the JCheckBox
tmp.addElement(new Boolean(false));
tmp.addElement(fileName);
tmp.addElement(new Integer(fileNo));
tmp.addElement(jobName);
tmp.addElement(jobUser);
tmp.addElement(jobNo);
tmp.addElement(page);
tmp.addElement(date);
tmp.addElement(time);
rowData.addElement(tmp);
splfList.close();
catch( ExtendedIllegalStateException ex )
System.out.println(" The list was closed before it completed!");
catch( Exception e )
// ...handle any other exceptions...
e.printStackTrace();
return rowData;
//return arrRowData;
// This is where the foreground thread waits to be awaken by the
// the background thread when the list is updated or it ends.
private synchronized void waitForWakeUp()
throws InterruptedException
// don''t go back to sleep if the listener says the list is done
if (!fListCompleted)
wait();
// The following methods implement the PrintObjectListListener interface
// This method is invoked when the list is closed.
public void listClosed(PrintObjectListEvent event)
System.out.println("*****The list was closed*****");
fListClosed = true;
synchronized(this)
// Set flag to indicate that the list has
// completed and wake up foreground thread.
fListCompleted = true;
notifyAll();
// This method is invoked when the list is completed.
public void listCompleted(PrintObjectListEvent event)
System.out.println("*****The list has completed*****");
synchronized (this)
// Set flag to indicate that the list has
// completed and wake up foreground thread.
fListCompleted = true;
notifyAll();
// This method is invoked if an error occurs while retrieving
// the list.
public void listErrorOccurred(PrintObjectListEvent event)
System.out.println("*****The list had an error*****");
fListError = true;
listException = event.getException();
synchronized(this)
// Set flag to indicate that the list has
// completed and wake up foreground thread.
fListCompleted = true;
notifyAll();
// This method is invoked when the list is opened.
public void listOpened(PrintObjectListEvent event)
System.out.println("*****The list was opened*****");
listObjectCount = 0;
// This method is invoked when an object is added to the list.
public void listObjectAdded(PrintObjectListEvent event)
// every 25 objects we'll wake up the foreground
// thread to get the latest objects...
if( (++listObjectCount % 1) == 0 )
//System.out.println("*****1 more objects added to the list*****");
synchronized (this)
// wake up foreground thread
notifyAll();
}

Hi,
You could try posting with the code tags (http://forum.java.sun.com/faq.jsp#format). Few people are prepared to read that much code without pretty formatting.
Check out this forum aswell, it is dedicated to JT400: http://www-912.ibm.com/j_dir/JTOpen.nsf/By+Date?OpenView

Similar Messages

  • How to read azure storage data using JAVA with REST API

    Hi,
    We have a cloud service in our lab. We have enabled diagnostics
    in cloud services. So WADPerformanceCounterTable was created in storage account. Now , We want to read the WADPerformanceTable using
    JAVA with REST API. Is there any way to collect these details. please give me any
    sample code to connect azure storage using table service REST API.
    Thanks & Regards
    Rathidevi

    Hi,
    Please have a look at this article:
    https://convective.wordpress.com/2010/08/18/examples-of-the-windows-azure-storage-services-rest-api/, it demonstrate how to use table service Rest API, it also give us the code, hope this helps. Of course, the
    MSDN article could also help us coding.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problem with too small page size using Java 2D Printing API.

    Hello,
    I have problem with resolution of printer using Java 2D Printing API. Despite my printer has 600 x 600 DPI, inside java.awt.print.Printable.print(Graphics, PageFormat, int) I receive page format with 600 x 840 page size.
    I have tried to set resolution using javax.print.attribute.PrintRequestAttributeSetand javax.print.attribute.standard.PrinterResolution, but with no result.
    Can anybody solve this problem?
    Regards,
    Karl.

    600 x 840 is a Point value; Point is defined as 1/72nd of an inch. Printers do have much higher DPI than this, but I believe that this DPI has to do with richness of the printed image, not an actual ability to color with that level of resolution. You might want to try calling zoom on your Graphics2D object. Otherwise, I don't know what else you can try.

  • How can I get selected EXCEL area using java script office API (v 1.0)

    Hello everyone,
    I need to get values of specified area in an excel sheet using java Script Office API. For an example,
    A1:A7 row load into array using JS. 

    And you posted to a C++ forum, not a JavaScript or Excel forum.... why? 
    Visual C++ MVP

  • CORBA Connection using Java ORB

    Has anyone had any experience connecting to a CORBA object published in an Oracle 8.1.5 database using a different ORB than the visigenic ORB?
    I've been able to connect using the visigenic (Oracle-flavor) ORB from my workstation when I compiled and executed with JDK 1.1.8.
    But the project I'm working on requires Java 2. The CORBA classes in Java2 prevent me from using the available visigenic classes so I am attempting to use the Java2 ORB.
    Does anyone know the steps necessary to accomplish this?
    Thanks,
    Jonathan Keller
    Web Application Developer
    U.C. Davis

    Thanks Sandeep,
    Though I don't know which APIs to use here, but i have seen MDM 7.1 does support SSO, and it has some connection constructor that needs just the user name and not the password for creating user session, if such is the case, i think it would be convenient to get the logged in user id from user session and then use it to create the user context.
    Regards,
    Nitin
    Edited by: Nitin Mahajan on Jan 3, 2009 7:10 AM

  • DialUp Connection using Java

    Dear friends
    I am facing problem,How to get DailUpConnection in Java .Is there any APIs which provide the DialUpConnection.
    Please mention the API's or Sample code .
    thanks

    As the previous reply states, my computer has been configured to automatically connect using dial up services, whenever windows determines a connection is needed.
    I was wrong to say that Java does this. However, I just thought it might be easier for you to configure you internet connection to automatically connect when needed.
    When I run the following program an automatic connection is made. If I am not configured for automatic dial up, then a dialog box is displayed asking me to connect:
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.HttpURLConnection;
    public class URLTester
         private final static String PROTOCOL = "http://";
         public static void main(String args[])
              if ( args.length != 1 )
                   System.out.println("Usage: java URLTester <url>");
                   System.exit(-1);
              String urlString = args[0];
              try
                   // Create URL object from the URL string
                   URL url = new URL(PROTOCOL + urlString);
                   // The connection object has information that my be
                   // retrieved without parsing the data returned
                   HttpURLConnection conn = (HttpURLConnection)url.openConnection();
                   conn.connect();
                   // Get an input stream from the URLConnection object
                   // Note: if you dont need connection information you can get an
                   // input stream from the URL object ( url.openStream() )
                   InputStreamReader isr = new InputStreamReader( conn.getInputStream() );
                   BufferedReader in = new BufferedReader( isr );
                   String line;
                   while ( (line = in.readLine() ) != null )
                        System.out.println( line );
                   in.close();
              catch(IOException e)
                   System.out.println( e );
    }

  • Crystal Reports data connection using Java beans

    Hi
    My name is Bach Ong, i'm currently perform re-configuring Crystal reports 2008 to connect via
    Java bean to Jboss server, this uses look up service on JBoss server. The connection is using Connect
    look up using the properties:
    java.naming.provider.url=jnp://emgsydapp121:10499
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    for file CRConfig.xml i put as follows:
    <JDBCURL></JDBCURL>
    <JDBCClassName></JDBCClassName>
    <JDBCUserName></JDBCUserName>
    <JNDIURL>jnp://emgsydapp121:10499</JNDIURL>
    <JNDIConnectionFactory>org.jnp.interfaces.NamingContextFactor
    y</JNDIConnectionFactory>
    <JNDIInitContext>/</JNDIInitContext>
    <JNDIUserName></JNDIUserName>
    Can you advise us if this step is correct, and is there any
    documentation that can guide us to right direction.
    for Java testing in Eclipse using remote call class it is working suing the following code:
            Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
            p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
             InitialContext ctx = new InitialContext(p);
      Date asAtDate = CrystalUtils.convertToDate("2014-01-01", CrystalUtils.relativeToToday(0), false);
         String asxCode = "BHP";
         ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
         InitialContext context = new InitialContext(p);
         ClosingPricesReportService ejb = (ClosingPricesReportService) context.lookup(ClosingPricesReportService.REMOTE_JNDI);
         ClosingPricesReport report = ejb.createMTMClosingPriceReport(criteria);
         System.out.println(report.getClosingPrices()[0].getClosingPrice());
         testval = report.getClosingPrices()[0].getClosingPrice().toString();
         System.out.println(testval);
    when i run the tes code the results as follow:
    10:49:45,244 DEBUG [SecurityAssociation ] Using ThreadLocal: false
    10:49:45,338 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] constructed
    10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connecting
    10:49:45,338 DEBUG [MicroSocketClientInvoker ] Creating semaphore with size 50
    10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connected
    10:49:45,369 DEBUG [ClientSocketWrapper ] reset timeout: 0
    10:49:45,650 DEBUG [InvokerRegistry ] removed SocketClientInvoker[709446e4, socket://emgsydapp121:10473] from registry
    10:49:45,650 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] disconnecting ...
    10:49:45,650 DEBUG [SocketWrapper ] ClientSocketWrapper[Socket[addr=/10.137.2.40,port=10473,localport=64150].2cba5bdb] closing
    37.99000000000000198951966012828052043914794921875
    37.99000000000000198951966012828052043914794921875
    Can anyone assist me in convert the above settings to get access by Crystal reports.
    My attemp current are below:
    public class CFDClosingPricesRpt extends CrystalReport {    
        //Constructor
        public CFDClosingPricesRpt(){
            super(ClosingPriceBean.INSTANCE);
         * Returns the ResultSet for this report to Crystal.
         * @param asxCode
         * @param asAtDateString
         * @return
    public ResultSet getNewReport(String asxCode, String asAtDateString) {                     
         try {
             Properties p = new Properties();
             p.put(Context.INITIAL_CONTEXT_FACTORY,
             "org.jnp.interfaces.NamingContextFactory");
             p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
             p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
             //InitialContext ctx = new InitialContext(p);
             clearCachedReportBeans();     
       Date asAtDate = CrystalUtils.convertToDate("2013-01-01", CrystalUtils.relativeToToday(0), false);
          asxCode = "BHP";
          ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
          //ClosingPricesReportService ejb = (ClosingPricesReportService) ctx.lookup(ClosingPricesReportService.REMOTE_JNDI);
          ClosingPricesReportService ejb = (ClosingPricesReportService) ServiceLocator.getInstance().getService(ClosingPricesReportService.REMOTE_JNDI);           
          ClosingPricesReport report = ejb.createClosingPriceReport(criteria);
          // assemble Crystal-friendly DTO
          Collection closingPrices = Arrays.asList(report.getClosingPrices());
          for (Iterator iter = closingPrices.iterator(); iter.hasNext();) {
                    MBLXClosingPrice cp = (MBLXClosingPrice) iter.next();               
                    if (cp==null) continue;               
                    addReportBean(new ClosingPriceBean( report.getSuppliedDate(),
                                cp.getClosingPrice(),
                                cp.getAsxCode()));
      } catch (Throwable x) {     
          saveErrorMessage(x);
      return getAsResultSet();             
    Thanks
    Bach Ong

    Hi Don Thanks for the reply.
    I've was able to connect via Java beans and JNDI. But this one is going the JNDI of JBoss sever, which the JNDI already configure and working for Crystal reports v10.
    Bach

  • Measuring performance tcp udp connection using java

    ho
    find t answers for these questions ..
    1. Is it possible to set some upper cut off for the data rate or transmission rate in TCP or UDP ?
    2. IF true, get t source code for t same ?
    3. is it possible to measure t data rate of a TCP or UDP connection ?
    4. get t compl source code for broadcasting using java ?
    sry im learning to use java sry if my questions are rookie and absurd . .
    pl bear wit me . .
    thank u in advance . .
    bye bye

    hi ebj and kayaman ,
    thanks for the reply for my first question . .
    "No, but you can limit the receive window which can have a similar effect."
    my second question was ...
    can help me out by giving the java code for the first question`s solution ?
    and my third question ...
    Is it possible to measure the throughput / transmission rate in which the udp or tcp transfer is taking place ??
    i think i ve made myself clear to you guys ..

  • AIR application and database connectivity (using JAVA)

    Hi
    I am creating AIR application and I want to connect with the database using java database connectivity (JDBC).
    Can any body give me the some suggestion on how to how to do that.
    Please give me any reference for creating AIR application for database connectivity with mysql/access.
    Thanks
    Sameer

    lots of serching on the google and found that For AIR applications either you use Webservices(JAVA/PHP/.Net) or you can use SQLLite.
    Not found any method for direct connectivity with the database using JDBC.
    If any one found direct connecivity withe database using JAVA then please reply.
    Thanks

  • Unable to establish SSL connection using Java PKCS11

    I am currently trying to establish SSL connectivity using eToken via PKCS11.
    The PKCS11 provider is setup and I can read the 3 stored certificates as a key Store Object.
    But I am getting the following exception while trying to establish SSL connectivity.
    I am using JDK 6.0(java version "1.6.0_31-rev).
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.security.InvalidKeyException: Unsupported key type: SunPKCS11-aladdin-0 RSA private key, 2048 bits (id 147980297, token object, sensitive, unextractable)
    at sun.security.mscapi.RSACipher.engineGetKeySize(RSA Cipher.java:384)
    at javax.crypto.Cipher.b(DashoA13*..)
    at javax.crypto.Cipher.a(DashoA13*..)
    Code:
    KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
    KeyStore keyStore = getClientKeyStore(); //read Smart Card Token to get the Certificate
    kmf.init(keyStore, "mycardPin".toCharArray()); //#### hard coded the i/p parms
    TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
    KeyStore trustStore = KeyStore.getInstance("JKS");
    trustStore.load(new FileInputStream("C:\\Users\\usr1\\Desktop\\Certifi cates\\mycertca.jks"), "mycardPin".toCharArray());
    tmf.init(trustStore);
    SSLContext sslContext = SSLContext.getInstance("TLS");
    sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
    factory = sslContext.getSocketFactory();
    sslClient = (SSLSocket) factory.createSocket(host, port);
    sslClient.startHandshake(); //<--- code is breaking here with the above exception
    I am struggling like anything for the last 4 days to get rid of this issue. Please let me know is there any work-around to fix this issue.
    I really appreciate your help.

    Hi,
    have You found the solution. I have similar problem but now it is not repeatable. I'm not sure what was the reason (this InvalidKeyException apeared only once). I'm using JDK7 (java version 1.7.0_09-b05).
    Caused by: java.security.InvalidKeyException: Unsupported key type: SunPKCS11-GemSafe RSA private key, 1024 bits (id 2, token object, sensitive, unextractable)
         at sun.security.mscapi.RSACipher.engineGetKeySize(RSACipher.java:404)
         at javax.crypto.Cipher.passCryptoPermCheck(Cipher.java:1052)
         at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1010)
         at javax.crypto.Cipher.init(Cipher.java:1209)
         at java.security.Signature$CipherAdapter.engineInitSign(Unknown Source)
         at java.security.Signature$Delegate.init(Unknown Source)
         at java.security.Signature$Delegate.chooseProvider(Unknown Source)
         at java.security.Signature$Delegate.engineInitSign(Unknown Source)
         at java.security.Signature.initSign(Unknown Source)
         at sun.security.ssl.RSASignature.engineInitSign(Unknown Source)
         at java.security.Signature$Delegate.engineInitSign(Unknown Source)
         at java.security.Signature.initSign(Unknown Source)
         at sun.security.ssl.HandshakeMessage$CertificateVerify.<init>(Unknown Source)
         ... 53 more

  • Navigation Panel using Java Bean Base API

    Hi,
    I would like to know how do I add the standar navigation panel to my map using the oracle.lbs.mapclient.MapViewer object. I have try different forms which include adding a tile theme layer but its not working. I'm not using the JS API since I want to have an applet.
    Thanks in advance.
    Susana

    Hi,
    in MapViewer's web page there is a link to some demos. There you can find a few examples of how to use the Java bean with jsp pages.
    If you want to implement a simple java (desktop) application, the following code contains the basic information that you need to start the MapViewer object, set the display parameters, and then add some information to generate a map image. In this example, a base map is used to generate the map.
        String url = "http://localhost:7001/mapviewer/omserver";
        try
          MapViewer mapViewer = new MapViewer(url);     // creates MapViewer object
          mapViewer.setDataSourceName("mvdemo");       // sets the data source (must exist in Mapviewer server)
          mapViewer.setMapTitle("MVDEMO base map");           
          mapViewer.setAntiAliasing(true);    
          mapViewer.setImageFormat(MapViewer.FORMAT_RAW_COMPRESSED);
          mapViewer.setDeviceSize(new Dimension(600,475));
          mapViewer.setCenterAndSize(-116.65,38.92,19.2);         // sets the map area
          mapViewer.setBaseMapName("DEMO_MAP");
          System.out.println(mapViewer.getMapRequestString());    // this prints the current map request to be issued
          boolean response = mapViewer.run();      // executes the request
          if (response)
              Image img = mapViewer.getGeneratedMapImage();
             // do something with the image in your Java application
        }catch(Exception ex)
           ex.printStackTrace(System.err);
        }The API java doc (see APIs link in MapViewer's web page) contains a more detailed description of the methods that can be used with the Java bean API.

  • How to use Java Data Mining API(JDM)

    hello,
    i have downloaded the JDM API(dmapi-1_0_1-fr-spec.zip) from JSR 000073. In the Readme.txt file, I have read that the components required to use the API are jdm.jar and jdmtck.jar.
    But these two files didnot come with the above zip file. The zip file contained other zip files namely RI.zip, TCK.zip, Spec.zip, etc.
    If somebody knows how to use this API, please please let me know
    My personal email ID: [email protected]

    Even I am not able to understand how to use it. How useful is the JDM API to make a new algorithm?
    Thank you,
    Arunraj

  • Ftp connection using java

    Hi All,
    I need to upload a file through ftp connection uisng java calss. any one know please reply me
    Thanks
    K.Kalikumar

    Hi Kali,
    I have worked on similar issues sending you the code.. hope it should work. I had written a TelnetInterface class where I did all operation inside the constructor.
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.InputStream;
    import java.io.PrintStream;
    import org.apache.commons.net.telnet.TelnetClient;
    public class TelnetInterface {
         private TelnetClient telnet = new TelnetClient();
         private InputStream in;
         private PrintStream out;
         private String prompt = ">";
         private boolean isConnected ;
    public TelnetInterface(){
         public TelnetInterface(HttpServletRequest request) {
                   HttpSession session = request.getSession();
                   PropertyReader propReader = (PropertyReader)session.getAttribute("propReader");
                   String host=null,user=null,password=null,port=null;
                   int unixPort= 0;
    //                Get Unix credentials
                   if(propReader != null){
                        host=(String)propReader.getProperty("UNIX_HOST");
                        user=(String)propReader.getProperty("UNIX_UNAME");
                        password=(String)propReader.getProperty("UNIX_PWD");
                        port=(String)propReader.getProperty("UNIX_PORT");
                        unixPort = Integer.parseInt(port) ;
    //                    Connect to the specified server
                   System.out.println("Inside telnet Interface");
                   try{
                        telnet.connect(host, unixPort);
                        isConnected = true;
                        in = telnet.getInputStream();
                        out = new PrintStream(telnet.getOutputStream());
    //                    Log the user on
                        readUntil("login: ");
                        write(user);
                        System.out.println("user:"+ user);
                        readUntil("Password: ");
                        write(password);
                        System.out.println("password:"+ password);
                        sendCommand("su - loginuser");
                        su(" password");
                   }catch (IOException e) {
                        e.printStackTrace();
                        isConnected = false;     
                   }catch (Exception e){
                        e.printStackTrace();
         }

  • Maximum number of concurrent connections using java sockets

    How can we find out the maximum number of concurrent connections that can be handled by a pooled connection server?
    I have a pooled server which creates a predefined number of handlers. Upon receiving a new request it accepts the connection and sends it to one of the handler.
    The solution works well for low number of concurrent connections - < 50 or 100
    But as the number increases there seems to be an issue
    1. Ignoring request even if i increase the handlers
    2. Increase in delay. [I feel that the listening thread is not getting the time slice to go read the socket for new requests]
    Any idea as to how i can solve this?
    Would an NIO socket help [am using the conventional java.io Serversocket, because my clients may not be non-blocking]??
    Any help would be appreciated.
    Anp

    There is no set maximum, but it is in the thousands on most platforms. I have a production server that handles tens of thousands of connections simultaneously. Most likely you have a bug in your code.

  • Making RPC connection using JAVA

    1-I have a C++ component which understands RPC only , so how to create a JAVA middleware component which establishes the connection with C++ component using RPC .
    how can we take adv of Webservices in java
    2- I need to convert java object to a XML file and pass on to the socket to forward this to 3rd party server (Encoding)
    3 - How i read the XML message response from the third party server and convert it to java object (Decoding)

    Is that the only way? I'm using Metrowerks CodeWarrior as my Java IDE, is there a way other than VJ++ to convert a .JAR file to .DLL?

Maybe you are looking for