While readline, input buffer

Hi,
I am building my first java app (beyond "hello world"), its a distributed computing client.
But i'm having a problem with the socket input method i designed:
    public String In(Socket s){
        try{
            InputStream in = s.getInputStream();
            InputStreamReader isr = new InputStreamReader(in);
            br = new BufferedReader(isr);
            while (true)  {
                String line=br.readLine();               
                if (line == null) {
                    break;
                data += br.readLine();                  
            br.close();
        }catch(IOException e){
            System.out.println("SocketHandle.In IO Error: " + e);
        return (data);
    }The problem is the while loop doesn't stop after its got these 2 lines:
Mp3Realm DistribuJob Server 1.0<<< Type `/help` for a list of commands.\nDistribuJob Server 1.0 Currently serving 4 clients, Your Host: 81.129.107.251, L
ogged in since: 2005-07-09 08:03:55\n
The program just keeps running, and doesn't make it far enough to the return statement to return the data to the mehtod calling it.
Thanks.

Problem was that the BufferedReader needed closing. I decided to change my app so it only sends 1 line of data.
To anyone that may want example code:
    public String In(Socket s){
        try{
            InputStream in = s.getInputStream();
            InputStreamReader isr = new InputStreamReader(in);
            br = new BufferedReader(isr);
            String input;
            data=br.readLine();
            br.close();
        }catch(IOException e){
            System.out.println("SocketHandle.In: I/O Error");
        return (data);
    }

Similar Messages

  • [INS-08109] Unexpected error occurred while validating inputs at state 'get

    Facing that on a windows 2003 server on installing 11gR2 on an installed 11.1.0.6
    [INS-08109] Unexpected error occurred while validating inputs at state 'getOCMDetails'.
    that's in the first step on the installer

    Very stupid installer !
    I've omitted my email, then pressed no in the next message, it passed that step!

  • INS-08109 Unexpected error occurred while validating inputs at state nodeselection page

    Scenerio: We have 4 node 11gr2 RAC cluster and Trying to install RAC Database software only on two nodes
    Getting warning on run Installer Page INS-08109 Unexpected error occurred while validating inputs at state nodeselection page while selecting two nodes out of four and even after confirming it comes back to same screen ....
    Example ... RAC node A,B,C,D  and clusterware is up and running on all four nodes .....
    Trying to Install RAC database on node C,D ... Getting INS-08109 Unexpected error occurred  while selecting C,D  Node out of Four nodes ...A,B,C,D

    Very stupid installer !
    I've omitted my email, then pressed no in the next message, it passed that step!

  • In TestStand, How do I pass variables to a sequence, other than the standard Input Buffer?

    I have Labview VIs that have arrays as inputs, I want to pass information in that array to the VI. TestStand already has the Input Buffer setup, but how do I create more input buffers, like array input buffers?? I know that the "Parameters" section in the sequence file is for passing info to subsequences, but that does not help me, Thank you in advance!!

    See the TestStand shipping example located in the directory \Examples\AccessingArrays\UsingLabVIEW. This will show you how to pass arrays back and forth from a VI to a sequence variable.
    If you are trying to create a step that handles arrays, then you will need to create a new step type that has an array step property. There is an example on the NI web site of a step type that handles arrays. Go to www.ni.com/support and search the Examples Program database using the search string of:
    +"step type" +waveform +teststand

  • Instrument reports: Input buffer overrun (Error -363)

    Hi all,
    I am currently trying to control an Ametek XG 12-240 DC power supply using LabVIEW 2013. I have downloaded all of the drivers from Ametek and can communicate with the device using NI MAX. When I run the "ametek simple example.vi" to set a current and voltage level and turn on the power output, I get
    "Error -363 occurred at Ametek XG Power Supply.lvlib:Error Query.vi 
    Possible reason(s):
    Instrument reports:
    Input buffer overrun;"
    I am new to LabVIEW and have not found any online solution to the problem. Any suggestions?
    Attachments:
    labview_error.JPG ‏107 KB
    labview_block_diagram.JPG ‏76 KB

    That's an IVI driver written by Ametek/Sorensen with a custom error code created by them. If you have CVI, you could perhaps debug the driver yourself. Otherwise, you might want to contact the vendor. Running I/O Trace would give you an idea of what commands are being sent.
    The last time I used one of their IVI drivers, ki had problems as well. Instead of doing any debug, I just spent a couple of hours writing a LabVIEW driver. A power supply is a simple instrument.

  • RMAN-00558: error encountered while parsing input commands

    Hi,
    on 12C on Win 2008
    as said in documentation :
    @ (at sign)
    Example 2-2 Running a Command File Within RMAN
    This example shows how you can execute a command file from the RMAN prompt and from within a RUN command. User-entered text appears in bold.
    RMAN> @backup_db.rman
    I do as follows to run a script to back up :
    RMAN> @C:\scripts\RMAN\al_backup_full_cdb.rman LOG=C:\scripts\logs\al_backup_full_log
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01009: syntax error: found "log": expecting one of: "double-quoted-string, identifier, integer, single-quoted-string"
    RMAN-01007: at line 1 column 1 file: standard input
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01009: syntax error: found "@": expecting one of: "double-quoted-string, identifier, integer, single-quoted-string"
    RMAN-01007: at line 0 column 1 file: standard input
    Thank you.

    user10274093 wrote:
    yes thank you. Like this :
    @C:\scripts\RMAN\al_backup_full_cdb.rman
    But how to have a log file ?
    You can not use the log= clause *inside* rman, you can only use it on the shell prompt *outside* rman.

  • Dovecot imap-login: Disconnected: Input buffer full

    dear community,
    anyone tried to setup a goldentriangle AD / OD with kerberos?
    this is especially in respect to dovecot login.
    settings done as in HT4778
    It fails with "dovecot imap-login: Disconnected: Input buffer full"
    there is a known issue, where the input buffer is filled up with the (ad) kerberos ticket and fails, as it is too small.
    kinit is fine, tgt for imap is there.....
    can anyone confirm this issue?
    best
    hartmut

    ok, what a pain, login is CASE-SENSITIVE ! So take care what username you take!
    hope it helps someone else....
    It can also throw strange numbers and letters when trying to login!
    best
    Hartmut

  • SQL *Plus input buffer

    I have a large script that works fine on my oracle server. When I bring it to my clients, it gets truncated after around 60 lines. I know how to increase the output buffer (EXEC DBS_Output.Enable(10000) for 10000 lines) but I can't seem to find the equivalent for the input buffer. Please help.

    Are you using SQL Plus client, then you need to change the buffer size on the menu of the SQL Plus window.

  • INS-08109 unexpected error occured while validating inputs at state 'nodeSe

    HI,
    I am installing and configuring oracle 11gr2 in vmware(OEL 4). I have installed successfully 11g grid successfully. Now i am trying to install oracle 11g rac software. While selecting the node, It shows the below error.
    INS-08109 unexpected error occured while validating inputs at state 'nodeSelectionPage'
    Cause:No additional information available
    Action: Contact Oracle Support services or refer to the software manual.
    Please help me solve this issue.

    u have resolved it . i has get the same issue.

  • Ins-08109 unexpected error occurred while validating inputs at state 'quick install'

    Dear All,
    I successfully configure clusterware for 2 node rac db. But when i try to install Oracle DB Software i am getting below error on 4 step .
    ins-08109 unexpected error occurred while validating inputs at state 'quick install'.
    Kindly advice over the same.
    Thanks in advance.

    Thanks John for your update,
    Actually whenever i ask a question on OTN and Sybrand replied over the same every time instead of giving solution or advice he always try to insult other. I know that he is very senior to me and i am here posting query not to waste important time of anyone but to get the solution. Yes i forgot to update the i goggled and applied the recommendation before posting my query here. But this is not the correct way to advice anyone. Infact he also cross out this level where i am. If you think i hurt sentiments of anyone i feel sorry for that. But this is not the right way to advice in fact you all are seniors and we are coming here to learn from you guy's. OTN is not private property of anyone.
    One thing more to say like you advice me calmly it's better to understand me how to do things accordingly now i will do that. Thanks again for your help and i will take care of all these things in future.
    Actually the problem mentioned above i faced first time and after google i didn't get any blog or site with the same mentioned error instead it will give me link mentioned below:-
    [Ins-08109] Unexpected Error Occurred 'Installoptionsui'.
    But mine was
    [ins-08109] unexpected error occurred while validating inputs at state 'quick install''
    I tried one of the blog that states that similar problem occurs when clusterware is not up. First i check whether clusterware is up or not i found that it is up. But still i restarted it and try the installation again but getting the similar problem again.
    In one blog it is mentioned that due to listener misconfiguration the problem occurs. I crosschecked listeners are configured from grid home.
    So applied both the sol which i get by typing the same error which i mentioned above but not successful to get the solution.
    In some website it is suggested that try to contact Oracle Support for the same.
    Ok the problem is sorted out,I do a fresh installation of OS, Clusterware and DB, now i am not facing the same problem. I think the problem is related to group permission. Now this time i mention all the details what i do and what is the result i think now its better to understand.

  • High CPU Usage while getting input from JTextArea

    I have a core class (emulator) that can receive and handle command strings of varying sorts. I have an Interface that, when implemented, can be used to work with this emulator.
    I have code that works, but the CPU is pegged. The emulator has its own thread, and my GUI, which implements the aforementioned Interface and extends JFrame, clearly has its own as well.
    So, the emulator calls the gatherResponse(prompt) method of the interface driving it, in order to find out the next command :
    Here is the code for this method (note that the console member variable is referring to the JTextArea that is within the JFrame) :
         public String gatherResponse(String prompt) {
              printPrompt(prompt);          
              lastPrompt = prompt;
              class ResponseListener extends Thread implements KeyListener {
                   public volatile String response = null;
                   public ResponseListener() {
                        super();
                   public void run() {
                        while (getResponse() == null) {
                             try {
                                       Thread.sleep((int)Math.random() * 100);
                             catch (InterruptedException ie) {
                                  System.out.println("ResponseListener.run==>"+ie.toString());
                   public String getResponse() {
                        return response;
                   public void keyPressed(KeyEvent e) {
                        System.out.println("ResponseListener.keyPressed==>"+e.getKeyCode());
                        if (e.getKeyCode() == 10) {
                             try {
                                  response = getLastConsoleLine();
                                  System.out.println("response found:"+response);
                             catch (Exception exc) {}
                   } //end public void keyPressed(KeyEvent e)
                   public void keyTyped(KeyEvent e) {}
                   public void keyReleased(KeyEvent e) {}
              } //end class ResponseListener implements KeyListener
              ResponseListener rl = new ResponseListener();
              console.addKeyListener(rl);
              System.out.println("Starting ResponseListener");
              rl.start();
              String response = null;
              while ((response = rl.getResponse()) == null) {
                   try {
                        Thread.sleep((int)Math.random() * 1000);
                   catch (InterruptedException ie) {
                        System.out.println(ie.toString());
              } //end while((response = rl.getResponse())==null)
              console.removeKeyListener(rl);
              System.out.println("returning "+response);
              return response;
         } //end public void gatherResponse(String prompt)     Like I said, this works just fine, but I don't want to go with it when it pegs the CPU. I've never really done any work w/ Threads, so I could be making a real newbie mistake here...

    Code adapted from The Producer/Consumer Example
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class Listening
        Scheduler scheduler;
        JTextField north, south;
        public Listening(Scheduler s)
            scheduler = s;
            north = new JTextField();
            south = new JTextField();
            north.setName("north");
            south.setName("south");
            scheduler.register(north);
            scheduler.register(south);
        private JTextField getNorth() { return north; }
        private JTextField getSouth() { return south; };
        public static void main(String[] args)
            Scheduler scheduler = new Scheduler();
            Listening test = new Listening(scheduler);
            Monitor monitor = new Monitor(scheduler);
            JFrame f = new JFrame("Listening");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test.getNorth(), "North");
            f.getContentPane().add(test.getSouth(), "South");
            f.setSize(240,125);
            f.setLocation(200,200);
            f.setVisible(true);
            monitor.start();
    class Scheduler
        private String contents;
        private boolean available = false;
        public synchronized String get(String caller)
            while(!available)
                try
                    wait();
                catch (InterruptedException ie)
                    System.err.println("Scheduler.get interrupted: " + ie.getMessage());
            available = false;
            System.out.println(caller + " get: " + contents);
            notifyAll();
            return contents;
        public synchronized void put(String sender, String input)
            while(available)
                try
                    wait();
                catch (InterruptedException ie)
                    System.err.println("Scheduler.put interrupted: " + ie.getMessage());
            contents = input;
            available = true;
            System.out.println(sender + " put: " + contents);
            notifyAll();
        protected void register(final JTextComponent tc)
            Document doc = tc.getDocument();
            doc.addDocumentListener(new DocumentListener()
                public void changedUpdate(DocumentEvent e) { /*styles*/ }
                public void insertUpdate(DocumentEvent e)  { report(); }
                public void removeUpdate(DocumentEvent  e) { report(); }
                private void report()
                    put(tc.getName(), tc.getText());
    class Monitor extends Thread
        Scheduler scheduler;
        JTextField  listenerField;
        public Monitor(Scheduler s)
            scheduler = s;
            launchDialog();
        public void run()
            boolean continueToMonitor = true;
            while(continueToMonitor)
                try
                    Thread.sleep(10);
                catch(InterruptedException ie)
                    System.err.println("Monitor.run interrupted: " + ie.getMessage());
                    continueToMonitor = false;
                String text = scheduler.get(this.getClass().getName());
                listenerField.setText(text);
        private void launchDialog()
            listenerField = new JTextField();
            JDialog d = new JDialog(new Frame(), getClass().getName(), false);
            d.getContentPane().add(listenerField, "North");
            d.setSize(300,100);
            d.setLocation(585,200);
            d.setVisible(true);
    }

  • CAN input buffer overflow due to RTSI frame?

    Hello,
    I'm reading a continuous stream of CAN-messages with a CAN-Object. I'm creating occurences and reading multiple samples in a while loop.
    A second (asynchronuous) task generates a RTSI trigger at specified intervals. I use this trigger to write a RTSI fram to the CAN buffer. However, I get buffer overrun errors frequently. I've set the read queue to 100 and I read 20 frames each time (on occurrence). I only seem to get these overrun errors when using RTSI!
    Does someone know what my problem might be?
    Thanks a lot!

    Hi Koektrommel
    If “…and generating a RSTI time stamp every 1 ms” means that you have a 1 kHz signal on the RTSI port and you want to timestamp this, then it could be very tight. Every RTSI pulse generates an interrupt on the CAN card that the processor needs to execute in addition to the interrupts coming from the CAN controller and the communication with the Windows OS.
    Two things I can think of, that potentially could make things a little faster:
    Do not use any CAN Objects. Due to their own queues, the CPU needs more processing time to handle to additional queues compared to just using the Network Interface Object.
    Use the CAN controllers filters to filter out as many (unwanted) frames as possible. If you have a Series 1 card, you would use the regular Mask/Comparator settings for ncConfig, for Series 2 hardware you need to use the Series 2 specific filter attributes.
    -B2k

  • How to detect line break while reading input ?

    Hi all,
    I am reading the user input from standard input.
    I want to detect the line break. So that I can stop reading input and proceed processing the string.
    Actually I am getting the SQL query as input and after that I am executing the same by passing it to a function.
    Pl. do reply me.
       Scanner scanner = new Scanner(System.in);             
            while(scanner.hasNext())
                 temp=scanner.next();
                  sql=sql.concat(" "+temp);
                 if(scanner.next=="\n")
                            break;
           System.out.println(sql);
           sqlTool.executeSQL(sql);
    The above is not working properly.

    But if new line comes, what will be it's value?Empty lines are discarded by the scanner.
    Kaj

  • Empty Business Rule Facts while assigning input/output facts

    jdev version - 11.1.1.2
    I am trying to call business rules from a BPEL. But when I try to assign input/output facts, business rule facts portion is shown empty.
    Please note that I have defined input and output facts while defining the business rule component. The input/output facts are based on following xsd:
    <?xml version= '1.0' encoding= 'UTF-8' ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.globalcompany.com/ns/CaseStudy/rules"
    targetNamespace="http://www.globalcompany.com/ns/CaseStudy/rules" elementFormDefault="qualified">
    <xsd:element name="approveInput">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="amount" type="xsd:double"/>
    <xsd:element name="approvalRequired" type="xsd:boolean"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="approveOutput">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="status" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    Input fact is of type "approveInput" while output fact is of type "approveOutput".
    I can share my project/application if required.
    Please let me know if something is incorrect/missing here.
    Thanks in advance

    HI,
    Do you have any question? The forum is for questions and discussions,
    if you want to share your Biztalk blogs, it's recommended to post it to TechNet Wiki, and you could follow the article below to join TechNet Wiki,
    Join TechNet Wiki: http://social.technet.microsoft.com/wiki/contents/articles/129.technet-wiki-how-to-join.aspx 
    Thanks for your understanding.
    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. <br/> Click <a
    href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

  • DSA Input buffer overwritte​n error

    Hi All,
    i am using 5 PXI 4472 and one FPGA 7833R. I need to perform continuous acquisition on all 40 DSA and 8 FPGA channels at maximum of 51.2 KiloSamples/second and 102400 Samples/block
    In my code i am having a while loop which will acquire dsa and FPGA data and write to file. When i consider 51.2 Kilo samples and 102400 Samples/block, the overall while loop delay is between 2000 to 2100 milli seconds. Meaning the file write and other calculations are getting compelted within 100 mseconds. i have assigned the buffer size of 1 Msamples/channels for DSA.
    I believe that even if the PC RAM size is greater, DSA allows only 1Msamples/channel buffer to allocate.
    I have also assigned 1.7 MB for FPGA DMA transfer host memory.
    When i acquire data simultanelously from FPGA and DSA in a single while loop, the acquisition is happening fine some 15 minutes after which DSA is giving DAQ channels overwritten error.
    But when i bypass FPGA acquisition, there is no daq error generated and acquisition is happening fine.
    i am have upgraded LV to 8.0.1
    Please share thoughts and experiences to get this solved.
    Thanks,
    Sudha

    The first thing I would try would be to update your RIO version to RIO 2.0.1.
    http://digital.ni.com/softlib.nsf/websearch/12E9CA​0820A192F08625714F005A8B0C?opendocument&node=13206​...
    Note this is an update to RIO 2.0 not a full RIO installation.  Also note that this is not RIO 2.0.2.  I do not think you need RIO 2.0.2.
    Reasoning:  Reading data from the FPGA DMA channel is a blocking method when using RIO 2.0.  That means it will consume 100% of the CPU while trying to get the data.  This is obviously fast, but can starve other high priority operations like reading other DAQ channels.  RIO 2.0.1 allows the Read to sleep while rating for the data to arrive.
    This may not entirely solve your problem, but it is a start and the update should definitely help a little.
    Regards,
    Joseph D.
    National Instruments

Maybe you are looking for