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();
     }

Similar Messages

  • Is it possible to have a secure FTP connection using private key authentication?

    Is it possible to have a secure FTP connection using private key authentication to connect to a folder on Business Catalyst?

    Hi,
    Not available at this stage as the only options can be found in the SFTP set-up article.
    - http://helpx.adobe.com/business-catalyst/partner/connecting-site-using-ftp-client.html
    Kind regards,
    -Sidney

  • 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 ..

  • FTP progarm using JAVA

    I need to fetch the files from Linux server through ftp using java. I am using the following package.
    org.apache.commons.net.ftp.*
    FTPClient class has the features like makeDirctory ,disconnect and so on.
    But, FTPClient class can not be recognizable. How can I make this cass as recognizable?

    Cross-post
    http://forum.java.sun.com/thread.jspa?threadID=639588&tstart=0

  • 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

  • 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 );
    }

  • Opening FTP connection using a bat file by Runtime class

    Hi
    I'm trying to run the following file from Runtime.getRuntime().exec(XXX) command and getting an error saying that login failed.
    I have set the user id and password in the ftpcommand.bat file as below
    User nkamar
    pass narendra
    and when I run this bat file from command prompt it doesn't work why???.It says Login failed.
    C:\>ftp -s:ftpcommand.bat 134.133.210.24
    Connected to 134.133.210.24.
    220 sdqa33 FTP server (SunOS 5.6) ready.
    User (134.133.210.24:(none)):
    331 Password required for User nkamar.
    530 Login incorrect.
    Login failed.
    ftp> opsnet1
    Invalid command.
    ftp> Invalid command.
    can you please help me in resolving this.
    A sample example file for setting the username,pwd and opening the ftp connection would be very helpful.
    Thanks in advance.
    Regards,
    Narendra.

    Rewrite your script as follow:
    open 134.133.210.24
    nkamar narendra
    Save it as ftpcommand.scr then call it.
    C:\>ftp -s:ftpcommand.scr
    If this still does not work try rewritting the script as follow:
    open 134.133.210.24
    user nkamar
    password narendra
    Save it and try again.
    Hope this works.
    ER

  • 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

  • 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?

  • Detect loss of socket connection using java.nio.channels.Selector

    I'm using the nio package to write a "proxy" type application, so I have a ServerSocketChannel listening for incoming connections from a client and then create a SocketChannel to connect to a server. Both SocketChannels are registered to the same Selector for OP_READ requests.
    All works fine, until either the client or server drops the connection. How can I detect this has happened, so my proxy app can drop the other end of the connection ?
    The Selector.select() method is not triggered by this event. I have tried using Selector.select(timeout) and then checking the status of each channel, but they still show isConnected()=true.
    Thanks,
    Phil Blake

    Please don't cross post.
    http://forum.java.sun.com/thread.jsp?thread=184411&forum=4&message=587874

  • FTP Connection Through JAVA

    I am writing a java code to transfer a file from local machine to a server on another machine.
    While uploading i am encountering with an exception which is showing as
    java.net.ConnectException: Connection refused: connect
    The file is getting transferred sucessfully if i am transferring it through command prompt instead of java code.
    Please help me out.

    Duplicated here
    http://forum.java.sun.com/thread.jspa?threadID=700335&messageID=4063726#4063726
    and here
    http://forum.java.sun.com/thread.jspa?threadID=700257&messageID=4063471#4063471

Maybe you are looking for

  • Resource pool selection enhancement in UCCX 7.0

    Good day. The issue is with our current CSQ setup and available resource pool selection criteria. Just for your record here is how its currently configured. We have five languages based CSQ’s operating in our call centre and following is how they are

  • Illegal use of Key Logger

    Help! I believe an ex boyfriend of mine has placed key logger on my computer. I already read about reinstall, which I may do if I can find the original discs for my computer, however, I'd like to prove key logger is even on the computer first. He has

  • I have a CC on file for gaming only, and wen I have no money on it I can never download a free app! An this should not happen! It's free apps!???

    I have a IPad, and a IPhone, I loaded a CC just for gaming, and every time ik don't have money on the card, I cannot download free apps, an this should not be happening because it is a free App..!!!??? What is going on!!??? I want to download an app

  • Boot Camp Update Does Not Install Completely

    I posted a question with this title back in April. Lots of others were having the same problem (trying to go from 2.1 to 2.2). Finally found a solution, but could not post it on the original question because the topic had been archived. I will post i

  • Smart form for PR

    Hi, My users wants Print of PR...Though i told them that PR is an internal document and SAP doesn't provide and smart forms for PR..But they are not getting convinced and they arre requesting smart form for PR... Is there and user EXIT or BADI for th