Input-/ouputStream hanging

Hi all.
I'm having some trouble with sending an XML-file via outputstream.
I think the problem is, that the receiving part, a SAXBuilder, doesn't recognize any end of file in the incoming data, and therefore keeps reading. My assumption is based on the fact, that if the sender's outputstream is closed, the receiver reads everything just fine. Flushing the stream doesn't appear to have any effect.
How do I avoid this? Is it perhaps possible to communicate an EOF after sending the document?
ServerConnection (sender):
import java.io.*;
import java.net.*;
import java.net.InetAddress;
import java.util.ArrayList;
import fsr.universal_classes.Customer;
import java.math.BigDecimal;
import org.jdom.*;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
public class ServerConnection implements Runnable{
    private InetAddress hostname;
    private int portNumber;
    private Socket connection;
    private BufferedWriter out;
    private BufferedReader in;
    private boolean connected = false;
    private String threadName = "ServerConnection";
    public ServerConnection(){
        new Thread(this).start();
    @Override
    public void run(){
        connectToDatabase();
    private synchronized void connectToDatabase(){
        portNumber = 49352;
        try {
            hostname = InetAddress.getLocalHost();
        } catch (UnknownHostException ex) {
            threadMessage("Couldnt find local host");
        try {
            connection = new Socket(hostname, portNumber);
            connected = true;
            out = new BufferedWriter(new PrintWriter(connection.getOutputStream(),true));
            in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        catch (IOException e) {
            System.out.println(e);
            connected = false;
    public ArrayList<Customer> getCustomers(){
        //  Create XML
        Element root = new Element("request");
        Element subject = new Element("subject");
        subject.setText("getAllCustomers");
        root.addContent(subject);
        // Create document and set DocType
        Document doc = new Document();
        doc.setRootElement(root);
        DocType xmlDoctype = new DocType("request", "src/commands.dtd");
        doc.setDocType(xmlDoctype);
        // Send XML
        XMLOutputter outputter = new XMLOutputter();
        outputter.setFormat(Format.getRawFormat());
        try {
            outputter.output(doc, out);
            out.flush();
        } catch (Exception e) {
            System.err.println("Exception: " + e);
        ArrayList<Customer> customersList = new ArrayList();
        return customersList;
    public void threadMessage(String message){
        System.out.println(threadName  + ": " + message);
Session (Receiver):
import java.net.*;
import java.io.*;
import fsr.server.exceptions.SessionStoppedException;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class Session implements Runnable{
    private Socket socket;
    private int id;
    private TCPServer tcpServer;
    private boolean connected = true;
    private SAXBuilder documentBuilder;
    private String threadName = "Session";
    public Session(Socket socket, int id) {
        this.tcpServer = TCPServer.getInstance();
     this.socket = socket;
        this.id = id;
        new Thread(this).start();
    @Override
    public void run() {
     try {
            communicate();
        catch(SessionStoppedException e){
            threadMessage("Session stopped: " + e.getError());
        catch(Throwable t){
            threadMessage("Session stopped (2)");
    public void communicate() throws SessionStoppedException {
        InputStreamReader ins;
        try {
            threadMessage("Getting input Stream");
            ins = new InputStreamReader(socket.getInputStream());
        catch (IOException e) {
            throw new SessionStoppedException("No info");
        while(connected){
            try {
                BufferedReader in = new BufferedReader(ins);
                threadMessage("Creating sax builder");
                documentBuilder = new SAXBuilder(true);
                threadMessage("Building document");
                Document doc = documentBuilder.build(in);
                System.out.println("Received: " + doc.toString());
                // If there are no well-formedness or validity errors,
                // then no exception is thrown.
                System.out.println(doc + " is valid.");
                System.out.println(doc.getRootElement().getName());
            // indicates a well-formedness or validity error
            catch (JDOMException e) {
                System.out.println( "is not valid.");
                System.out.println(e.getMessage());
            catch (IOException e) {
                System.out.println("Could not check " );
                System.out.println(" because " + e.getMessage());
            catch(Exception e){
                threadMessage("Error: " + e);
    public void threadMessage(String message){
        System.out.println(threadName + "(" + id + ")" + ": " + message);
}Thanks in advance.
Cheers,
Jonas

Jonas.Nielsen wrote:
I've been instructed, that there is no way to send a end of file.
What would probably help would be to send the size of the serialized document before sending the actual document. But how is that done?First, you should probably be using the stream directly, not wrapping it in a Writer, so you can write byte-oriented data. Then, if you knew the size of the document ahead of time, you could send the number of bytes as a long, followed by the document. If you don't know the number of bytes ahead of time, you could come up with some chunking protocol, where you would write the size of the chunk, followed by the chunk bytes. A chunk size of 0 could indicate EOF.
The DataOutputStream/DataInputStream wrapper classes can be of assistance here.

Similar Messages

  • EVDRE: INPUT TEMPLATE HANGING

    Just wanted to see if anyone has a clue as to why my input schedule is hanging.  I've tried multiple things please see below:
    1.  I've truncated the LCKFINANCE table to clear of any locks
    2.  Restarted the login credentials in SAP Server Manager
    3.  Restarted the SendGoverner Services
    4.  did an IIS restart
    Not sure why this is happening but can anyone help?

    Hi,
    Did you at leat light optimized your application, in order not to have more than 20'000 records into the ROLAP table called tblFactWB<app>?
    Hanging problems when sending data could also come from there.
    Hope it will help.
    Best Regards,
    Patrick

  • IMac 27"intermittent input hangs with ext display attached

    I'm having issues where every 3-4 seconds input will hang briefly with an external monitor attached. The monitor is a Dell E207WFPc connected via MDP-> DVI and the input devices range from the supplied wireless keyboard and Magic Mouse to wired keyboard and mouse. So far Activity Monitor doesn't show me that anything is spiking while this is happening. At first I thought it might me an issue with bluetooth but I turned off bluetooth and experienced the same issues.

    numbasicks, if you haven't already, see this thread:
    http://discussions.apple.com/thread.jspa?threadID=1965949
    So far we've been able to determine it's MDP -> DVI only and it has nothing to do with Bluetooth. No solution yet. My personal case is a 27" iMac, ATI Radeon HD 4850, connected to a 19" ViewSonic display.
    Message was edited by: Kai Brinker

  • Is there something that alerts when a command wants input or finishes?

    Many command line operations require waiting before requiring input (eg compiling and using package managers). Many of these offer options for ignoring all questions but sometimes you don't want to do this (or miss an argument) but don't want to check the terminal all the time.
    Is there a application that I can run in combination with these that will somehow alert me (sound?) that the application is finished/error or waiting for input?

    A finished / error state notification is easy, the program in question has finished, so you can run another program e.g. play a sound file so you know e.g. the compilation has finished.
    If it just waits for input or hangs, that's another thing.

  • Issues on ASH report

    I have an issue with generating ASH Report on Oracle 11gR2 (11.2.0.1) RAC (2-nodes) on HP-UX. Its working on one node but not the other.
    When I ran ashrpt.sql, its accepting all the inputs and hangs, its not ending. When I trace the session I get the following,
    Ioctl ASYNC_CONFIG error, errno = 1
    Ioctl ASYNC_CONFIG error, errno = 1
    WAIT #5: nam='control file sequential read' ela= 373 file#=0 block#=1 blocks=1 obj#=581 tim=70344326749
    WAIT #5: nam='control file sequential read' ela= 425 file#=0 block#=16 blocks=1 obj#=581 tim=70344327317
    WAIT #5: nam='control file sequential read' ela= 433 file#=0 block#=18 blocks=1 obj#=581 tim=70344327784
    WAIT #5: nam='control file sequential read' ela= 278 file#=0 block#=281 blocks=1 obj#=581 tim=70344328098
    WAIT #5: nam='control file sequential read' ela= 331 file#=0 block#=1 blocks=1 obj#=581 tim=70344329323
    WAIT #5: nam='control file sequential read' ela= 308 file#=0 block#=16 blocks=1 obj#=581 tim=70344329727
    WAIT #5: nam='control file sequential read' ela= 364 file#=0 block#=18 blocks=1 obj#=581 tim=70344330124
    WAIT #5: nam='control file sequential read' ela= 383 file#=0 block#=180 blocks=1 obj#=581 tim=70344330541
    WAIT #5: nam='asynch descriptor resize' ela= 2 outstanding #aio=0 current aio limit=0 new aio limit=2142 obj#=581 tim=70344330586
    Ioctl ASYNC_CONFIG error, errno = 1
    Ioctl ASYNC_CONFIG error, errno = 1
    WAIT #5: nam='control file sequential read' ela= 310 file#=0 block#=1 blocks=1 obj#=581 tim=70344363432
    WAIT #5: nam='control file sequential read' ela= 414 file#=0 block#=16 blocks=1 obj#=581 tim=70344363961
    WAIT #5: nam='control file sequential read' ela= 202 file#=0 block#=18 blocks=1 obj#=581 tim=70344364196
    WAIT #5: nam='control file sequential read' ela= 360 file#=0 block#=281 blocks=1 obj#=581 tim=70344364592
    WAIT #5: nam='control file sequential read' ela= 181 file#=0 block#=1 blocks=1 obj#=581 tim=70344365663
    WAIT #5: nam='control file sequential read' ela= 354 file#=0 block#=16 blocks=1 obj#=581 tim=70344366182
    WAIT #5: nam='control file sequential read' ela= 325 file#=0 block#=18 blocks=1 obj#=581 tim=70344366541
    WAIT #5: nam='control file sequential read' ela= 364 file#=0 block#=180 blocks=1 obj#=581 tim=70344366939
    WAIT #5: nam='asynch descriptor resize' ela= 1 outstanding #aio=0 current aio limit=0 new aio limit=2142 obj#=581 tim=70344366984
    Ioctl ASYNC_CONFIG error, errno = 1
    Ioctl ASYNC_CONFIG error, errno = 1
    ...............................................................................does anybody has similar problem?

    Hi,
    Yes, its possible.
    1. First create the tabular form on the table you want to update
    2. Go and edit the SQL Query , add all the tables and columns that you want
    3. Now edit the report attributes and remove the references to Table/Column in the source of all the non-base table columns.
    It has to be a 2 step process, the wizard does not allow you to enter a query of the type you have.
    Regards,

  • Run like Host command in plsql

    Hi,
    We are using Host command in sql*plus , but i need to implement like host command in Plsql. I refered previous post and some other links , that most of them are prefered only java stored procedure, And even that restricted previllage.
    Can you give some sample example launchiing Win OS command in plsql
    venki

    To run a batch file, you need to use the Command Shell (and please do not call it a DOS shell like some people tend to do as it is not DOS). E.g.
    c:\windows\system32\cmd.exe /c c:\temp\test.bat
    We're running cmd.exe with switch /c that tells cmd to execute the command we're passing it, and then to terminate.
    Note that we cannot interact with the shell from the PL/SQL side - we cannot answer prompts and so on. The script run, must be a proper batch/non-interactive script.
    Also, the Oracle Server process (Win32 thread actually) that is servicing our Oracle client connection, is running the command for us. This thread itself is a background service process. It could run in Windows configured environment (VM/Virtual Machine) that is not allowed to interact with the desktop - or have limited or no access to certain files, folders and programs.
    Technically speaking, this is what happens:
    1) we pass the command to execute from our client to the Oracle server session servicing us
    2) this Oracle thread uses the Java VM to make a Win32 call called CreateProcess()
    3) the Win32 kernel executes that process
    4) the process starts, runs and terminates
    5) the Java VM inside the Oracle Server process regains control and pass the exit code and standard output of that process to PL/SQL
    6) PL/SQL in turns, returns that very same data to our client
    If you for example run a program that pauses and expects input, or hangs.. it will cause the above series of steps to stop at step 4. With the Java VM waiting on it to complete, and we waiting for the Java VM and PL/SQL call to complete.

  • Flash player 16.0.0.235 problem on firefox 34

    In continuation of this: Flash player 16.0.0.235 unresponsive on Firefox 34.0.5
    Firefox disables the up to date flash plugin. If I manually enable it and try to see flash content then the cursor keeps blinking busy until I close the tab with the flash content.
    I have now noticed the the Flash plugin process does not start when I enable the plugin and try to view content. In contrast, flash works normally on Chrome. I dont know why, but it looks like firefox keeps trying to start the flash plugin process but doesnt manage to do so. Have reinstalled both flash and firefox but it didnt help.
    Please help!
    Edit: disabling protected mode seems to solve the problem, but I'm sure its not a good solution. Any input?

    [@ hang | CleanupPerAppKey] - Firefox 35.0 Crash Report - Report ID: 76cdf009-867f-476c-b058-9d79c2150114
    [@ hang | CleanupPerAppKey] - Firefox 35.0 Crash Report - Report ID: 1d22a090-d902-4236-bac6-a347d2150114
    [@ hang | CleanupPerAppKey] - Firefox 35.0 Crash Report - Report ID: 157c7b22-846e-4334-b3f5-2a9492150113
    [@ hang | CleanupPerAppKey] - Firefox 35.0 Crash Report - Report ID: 77556e1c-cd88-4974-83de-088192150113
    [@ hang | CleanupPerAppKey] - Firefox 35.0 Crash Report - Report ID: 2c1000b8-63b0-40a6-a381-7b8e92150113
    [@ hang | CleanupPerAppKey] - Firefox 34.0.5 Crash Report - Report ID: 6d25787e-51e9-41ed-bee7-391262150112
    [@ hang | IsWindow] - Firefox 34.0.5 Crash Report - Report ID: db452e02-99c6-4cd3-8bfe-cbd3f2150108
    [@ hang | CleanupPerAppKey] - Firefox 34.0.5 Crash Report - Report ID: ae3a838c-be29-4b84-8f15-581952141230
    [@ hang | CleanupPerAppKey] - Firefox 34.0.5 Crash Report - Report ID: 0825bf85-4b09-481f-9093-7da252141227
    [@ hang | ntdll.dll@0x3ceec] - Firefox 34.0.5 Crash Report - Report ID: acbcf451-c1d0-4737-a73b-301262141226
    [@ hang | ntdll.dll@0x3ceec] - Firefox 34.0.5 Crash Report - Report ID: c651dd8c-f860-4d74-bde9-e1cb22141226

  • EPM Performance Questions

    Hi Experts
    We have some concerns over performance in our BPC 10 (BW SP8, EPM SP13) performance.  I wanted to post a message here to hopefully get a better understanding of areas where we are currently uncertain and measures we could perhaps look at in order to improve.
    1. Every time we transport once of our BPC Input Schedules / Reports, we need to 'Save it Down' in the environment where it has been transported.  This procedure involves opening the report, refreshing the data in the report and then saving it.  If we don't do this, the report will still load but in a time of 10+ minutes rather than the 3 minutes we expect.  Any ideas why this is ?
    2. We experience improved performance when someone has run a particular report with identify selections.  I expect this is to do with the OLAP caching on the BW server.  Has anyone worked with this cache in order to improve performance ?  Is this cache redundant after every write back to the cube / model ?
    3. Our single model is getting rather large (50M records) and I'm looking into options for archiving / improving the setup.  Is 50M a cause for concern ?  I see a message on the boards earlier with someone having billions of records so perhaps not....
    4. Finally, I notice our reports / input schedules hang in the same place every time they are run.  Can anyone advise what can be checked ?  We are not using any Member Formulas
    Thanks in advance for any help / guidance you can offer.
    Ian

    yeh, everyone thinks that at some point. it relies,
    however, on you being perfect and knowing everything
    in advance, which you aren't, and don't (no offence,
    the same applies to all of us!). time and time again,
    people do this up-front and discover that what they
    thought would be a bottleneck, isn't. plus,
    the JVM is much smarter at optimizing code than you
    think: trust it. the best way to get good performance
    out of your code is to write simple, straightforward
    good OO code. JVMs are at a point now where they can
    optimize java to outperform equivalent C/C++ code
    (no, really) but since they're written by human
    beings, who have real deadlines and targets, the
    optimizations that make it into a release are the
    most common ones. just write your application, and
    then see how it performs. trust me on this
    have a read of
    [url=http://java.sun.com/developer/technicalArticles/I
    nterviews/goetz_qa.html]this for more info anda chance to see where I plagiarized that post from :-)
    Thanks for that link you gave me :)
    Was usefull to read.
    About time and money of programming, that is not really an issue for me atm since i'm doing this project for a company, but through school (it's like working but not for money).
    Of course it should not last entirely long but I got time to figure out alot of things.
    For my next project I will try to focus some more on building first, optimizing performance later (if it can be done with a good margin, since it seems the biggest bottlenecks are not the code but things outside the code).
    @promethuuzz
    The idea was to put collection objects (an object that handles the orm objects initialized) in the request and pass them along to the jsp (this is all done through a customized mvc model).
    So I wanted to see if this method was performance heavy so I won't end up writing the entire app and finding out halve of it is very performance heavy :)

  • Table lck files

    Hi All,
    In SQL 2005/BPC 7(I think I am at SP1, but upgrade scheduling is in process, which might answer this question)
    I am seeing an issue where table locks are getting created, and I can't figure out why. Several threads on this forum talk about input templates hanging and not sending their data due to lck[application name] holding onto a stale lock. Removing the lock seems to correct the issue.
    What I can't figure out is why the locks are getting in there. Some times it's evident, a user left it open the server rebooted etc etc, but once a month we reboot the server (SQL and App) just for housekeeping. Post-reboot I check for locks, and there are none. One users opens an the input template to add forecast data, and the input never finishes. We see locks in the db from that user - I remove them, reboot again, and voila that user can now input normally.
    Any thoughts appreciated -
    Edward

    Hi Edward,
    You already have the answer to your query.
    Whenever a user is trying to access a particular region, that region gets locked, so that, noone else can change that region. Because in that case, if some other user changes the data, the first user will get affected. This is the reason this region gets locked and you can see this in the lck table. Now, if the user is accessing a region and if his task doesnt get completed (the template gets hanged), then the region is not released. Only when the task gets completed, the region is cleared and the lock entries are deleted from the table. However, if the task is not completed, then the lock entries will remain in the table and no other user can work on that region. The users will definitely be able to work on other data sets but not on this region. So, the lock needs to be deleted manually.
    So, instead of looking at the lock table issue, I would suggest you to look into the users as in why their task is not getting completed.
    Hope this helps.

  • How to get 2nd app to write to 1st app "System.In"?

    Hey, I am trying to build a program that will control another program. It will do this by reading the output of the program and then sending it information as if a user had typed it in.
    The problem is that the 2nd app (referred from here on as the "CONTROLLER"), when run, hangs on the spot where the 1st app (referred from here on as the "HOST"), is waiting for "System.in" input.
    So the CONTROLLER will read the first line, display it, but then where it is supposed to wait for the user to type something in and write it to the HOST (which is using System.in for input), it hangs up. Because I have the .close() method inside my methods, it now at least closes the app instead of freezing.
    I've read http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html "When Runtime.exec() won't", and it doesn't really address my problem except to say "Thus, to circumvent the second pitfall -- hanging forever in Runtime.exec() -- if the program you launch produces output or expects input, ensure that you process the input and output streams."
    Which is fine, but I don't know how to handle the HOST using System.in waiting for input in my CONTROLLER app. Anyone got a method I can use for this? Here is the code.
    HOST:
    import java.io.*;
    public class myTest4 {
         public myTest4() {
              InputStreamReader inText = new InputStreamReader(System.in);
              BufferedReader buffText = new BufferedReader(inText);
              try {
                   System.out.print("Enter Customer Number:  ");
                   String firstIn = buffText.readLine();
                   int newvalue = Integer.parseInt(firstIn);
                   char char1 = firstIn.charAt(0);
                   System.out.println("Customer number entered: " + firstIn);
                        if (char1 == '1') {
                             System.out.print("Enter Comment:  ");
                             String comment = buffText.readLine();
                             System.out.println("You entered - " + comment);
                             System.out.println("Press ENTER to exit:");
                             System.in.read(new byte[10]);
                             System.exit(0);
                        else {
                             System.out.println("Press ENTER to exit:");
                             System.in.read(new byte[10]);
                             System.exit(0);
              catch(IOException err) {
                  System.out.println("Error reading line");
              catch(NumberFormatException err) {
                   System.out.println("Error Converting Number");
         public static void main(String[] args) {
                   myTest4 free = new myTest4();
         }CONTROLLER:
    import java.io.*;
    class LegacyProviderTest {
         protected Process theProcess;
         public void startSession(String command)
              throws IOException, SecurityException, NullPointerException,
              IllegalArgumentException, InterruptedException
              theProcess = Runtime.getRuntime().exec(command);
         public String readLines()
         throws IOException
              char[] theLine = new char[5000];
              int index = 0;
              BufferedReader is = new BufferedReader(new InputStreamReader(theProcess.getInputStream()));
              while (index < theLine.length)     {
                   int theCharacter = is.read();
                   if (Character.isISOControl((char)theCharacter)) {
                        break;
                   else {
                        theLine[index++] = (char)theCharacter;
              is.close();
              String theResult = new String(theLine);
              return theResult;
         public void writeLines(String line)
         throws IOException
              char[] theChars = new char[line.length()];
              BufferedWriter os = new BufferedWriter(new OutputStreamWriter(theProcess.getOutputStream()));
              for (int i=0; i < line.length(); i++) {
                   theChars[i] = line.charAt(i);
              os.write(theChars);
              os.close();
         public static void main(String args[]) {
              String input;
              LegacyProviderTest legacy = new LegacyProviderTest();
              try {
                   legacy.startSession("java mostSimple");
                   input = legacy.readLines();
                   System.out.println("Read input: " + input);
                   if (!input.equals("Enter Customer Number:  ")) {
                        System.out.println("Invalid response: " + input);
                        System.exit(1);
                   legacy.writeLines("12345");
                   input = legacy.readLines();
                   System.out.println("Read input: " + input);
                   if (!input.equals("Enter comment:  ")) {
                        System.out.println("Invalid response: " + input);
                        System.exit(1);
                   legacy.writeLines("hi there");
                   legacy.writeLines("");
                   System.out.println("Yahoo!!");
              catch (Exception e)     {
                   System.out.println("Got exception " + e);
                   System.exit(1);

    >
    Process p = Runtime.getRuntime().exec(my_cmd);
    InputStream inputStream = p.getInputStream();
    If you notice, I have the InputStream already initialized and then buffered, and the process is initializing correctly (to the point where it asks for System.in input).

  • Primavers Unifier File Transfer Utility - Seup error

    Dear All,
    Pertaining to the mentioned subject, I have problem setup the Advanced File Transfer Tool.
    Simply after I finish setup I have "Weblogic" stopped working.
    Please help

    Doubtful code:
    size = bis.available();
    if(size == 0)
    break;
    You have a buffered input stream hanging on a socket input stream. So what if the client gets ahead of the server? Answer: for a while, there is no data available.

  • Keyboard lockups with OSX 10.8.2

    After the 10.8.2 update, keyboard input is hanging intermittently on my 2011 MacBook Air. It occurs in several applications (have tested with Safari and App Store) and often when switching windows or input fields. The keyboard input just stops working for a few seconds, then some of the typed text is input at the cursor.
    Also, sometimes when opening a new tab in Safari, a window pops up complaining about a bluetooth headset. Maybe this is linked somehow?
    Anyone else experiencing the same?

    I've been following this discussion due to keyboard problem after update to 10.8.2.
    Using original USB keyboard (MB110LL/A) with keypad supplied with 2008 iMac.
    Problem: number keys (only on the keypad) fail after login, after updating to 10.8.2. Keypad numbers work as usual when entering system password at startup.
    Solution: tested keyboard at Apple Store & it works fine on their 10.8 demo machines. Purchased new keyboard to try (MB110LL/B), & that solves problem. After 4+ years, original needed retirement anyway.
    Refer to "Difference between MB110LL/A and MB110LL/B" discussion in Apple Store,
    http://store.apple.com/us/product/MB110LL/B/apple-keyboard-with-numeric-keypad?f node=56
    Time will tell if others with older iMacs encounter the same problem.

  • File Transfer error - stops at 26280 bytes.

    I am trying to make a little file transfer utility, and it works when I test the client and server sides on the same machine, but when I began to test the client and server on different machines it starts giving me problems. For files under 26280 bytes the file transfers completely, no problems. But for anything over that amount, the server stops the transfer and returns a bunch of errors on the server side. The client thinks the file is complete and quits. I am pretty sure it has something to do with the way I have set up the Streams. Here is the code snippit:
    For Server:
    OutputStream os = socket.getOutputStream();
         BufferedOutputStream bos = new BufferedOutputStream(os);
    File nFile = filename;
    long long_size = nFile.length();
    int size = (int)long_size;
    byte[] buffer = new byte[size];
    FileInputStream fis = new FileInputStream(nFile);
    DataInputStream dis = new DataInputStream(inStream);
    while(fis.read(buffer)!=-1){
    bos.write(buffer);
    bos.flush();
    For Client:
    InputStream is = sock.getInputStream();
    BufferedInputStream bis = new BufferedInputStream(is);
    FileOutputStream fos = new FileOutputStream(file);
    BufferedOutputStream bosfile = new BufferedOutputStream(fos);
    while(true) {
    size = bis.available();
    if(size == 0)
    break;
    byte[] pOutput2 = new byte[size];
    rc=bis.read(pOutput2, 0, size);
    if(rc == -1)
    break;
    bosfile.write(pOutput2);
    if(rc < size)
    count +=rc;
    break;
    else
    count +=size;
    Any help would be much appreciated. Thank you very much

    Doubtful code:
    size = bis.available();
    if(size == 0)
    break;
    You have a buffered input stream hanging on a socket input stream. So what if the client gets ahead of the server? Answer: for a while, there is no data available.

  • Sound Input Read VI hangs

    I'm using the SI Read VI to sample from the Soundblaster card in my Dell PC. I've configured the device for 16-bit mono input, sample rate 44.1 kHz, and the buffer size is 1024 samples. The SI Read VI is in a Timed Loop whose period I've set to 23 ms (1024 / 44.1kHz). Following each acquisition, I do some filtering, frequency analysis, and plotting inside the loop.
    The acquisition works well for the first 10 minutes or so that it is running. But sometime after about 10 or 15 minutes, the VI hangs. I've traced the hang back to the SI Read VI, but have not yet figured out how to avoid the hang or recover from it (I have to abort and restart the program).
    Has anyone had similar problems with the SI Read VI? Could there be a problem with the DLL that the SI Read VI calls? Are there any upgrades or fixes for this? Can someone suggest a way to recover from the hang?
    Thanks for any help,
    Mark

    This message is a reply to "Sound Input Read VI hangs" (National Instrument) NI Discussion Forums posting found at: http://forums.ni.com/ni/board/message?board.id=170&message.id=137258 and http://forums.ni.com/ni/board/message?board.id=170&message.id=110656&requireLogin=False
    Hi everybody,
    From the large count of how many of you guys read the above thread of messages, including myself, and who are dealing with the same problem of SI Read VI hanging found National Instrument (NI) LabVIEW (LV), I decided to share my (not so perfect) solution with you guys to save you time and frustration. Here is the story of 3 days (18 hrs/day) of my life, fighting a bug in SI Read VI (SI: Sound Input) (I am currently using LabVIEW Pro v 7.1.1):
    For the reason that "A Message cannot exceed 10,000 characters" on this Forum I included my message in the attached Word doc. Hopefully, there is no such limitation on uploaded files!
    Samir Berjawi
    Research Assistant and Lab Instructor
    American University of Beirut
    [email protected]
    [email protected]
    Attachments:
    LabVIEW SI Read freezes - Report.doc ‏39 KB
    Sound Acquisition Test.zip ‏995 KB

  • [Solved] Programs hang on keyboard input (uim-xim)

    Update: I've narrowed the issue down (via trial and error) to uim-xim.  If it's running, it causes this problem (in XMonad) and if it isn't, gnucash has no issues.  Oddly enough, when I start uim-xim by hand after gnucash, it works fine too.  Starting uim-xim by hand before gnucash results in the same issue, and so I'm inclined to believe it's either an issue with XIM implementation, or simply uim-xim.  Might also be a mixture of XMonad and uim-xim, as it works fine in Openbox.
    I've noticed lately that certain GTK programs (I'd list them, but I haven't paid close attention until today, where I was using gnucash) work fine until I try to input anything via the keyboard.  The moment I start typing (or, at the latest when I hit the shift key or backspace key) the program will hang (without any error message).  I originally assumed that this was an issue with the program - not my window manager.  However, I tried one of the problem programs (gnucash) in Openbox today, and it works just fine.  That leads me to assume it's caused by my configuration in some way.  I have absolutely no idea where to start debugging this issue. 
    A bit of information:
    I use UIM (in both openbox and XMonad with identical configurations), run a script for a Japanese date format in XMonad (piped to dzen), and load the same xmodmap file in both window managers.  Also, I start all my window managers using CDM (Console Display Manager), but in the case of XMonad I supply a bash script instead of the binary, in order to preload certain files.  Also, I use a german keyboard layout.
    <I removed the rest of this post because it was long and, ultimately, irrelevant>
    Last edited by lswest (2012-05-01 09:53:46)

    spectater wrote:
    Same situation, Confirmed here
    I'm having the same problem with my laptop after upgrading to  gnome 3 : 
      gnome-terminal  , gedit  can not accept  keyboard input , lower case letters, enter ,   backspace and so on ,   but  upper case letters are OK.
    files  can not be renamed with  nautilus , also the find function affected  in nautilus
    while other programs such as  xterm ,firefox  , pidgin  skype , thunar  leafpad  libreofficecan  ...and so on  work out of the box .
    lower case & upper case letters all are not accepted well in my case.

Maybe you are looking for

  • Concurrent access issue with JPA  for a Select query?

    Hi All, I have been trying to understand why this code, public <T> List<T> findManyNativeSql(String queryString, Class<T> resultClass)             Query aQuery = getEntityManager().createNativeQuery(queryString,resultClass); // Throwing the following

  • How to hide/suppress empty columns in pivot tables

    In a pivot table, is there any way to do something like "suppress missing data" to make an entire column hidden only if it is empty? I have a situation where I can't hide an entire measure because the measure has values for another dimension, but I w

  • The Energy Saver in System Preferences has no effect.

    Hi, I have my Energy Saver preference set to turn off my monitor after 20 minutes of idle time.  But the display never goes off. Energy Saver used to work, now it doesn't and I have no idea why not, or what changed. Any ideas? Thanks!!

  • IPhoto cropping exports

    I'm having a rather annoying issue with iPhoto, where certain photos are cropping to a very strange dimension when I export them. It doesn't affect all images, just some. They're not cropped in iPhoto, so I'm confused as to how this could happen. If

  • Disk may be damaged or full, or you may not have sufficient access privileg

    HI iWEB Guys, I'm at iWEB 2.0.3 (iWEB08). Been using it for a long whie. I have 24GB of .mac space with 16GB available - (derived from system/prefs/.mac) I am trying to publish a series of files for some work collaboration. Some of these objects are