Receiving continous data

Hi. I want to send data continously from one system to another. At the sender side if i didn't close the outputstream object i am able to send it continously but at the receiver side i am able to receive the data only once. The next time when it tries to receive i get the following exception:
java.io.EOFException
I am not closing the input stream object and i am using ObjectOutputStream and ObjectInputStream.
Can someone suggest a solution as to how i could continously receive data??? Plz reply.

At the sender side this is what i do
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
oos.writeObject(x);
oos.writeObject(y);
First time the co-ordinates are sent,during the second run I got the exception:
java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputSt
ream.java:1676)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeByte(ObjectOutp
utStream.java:1714)
at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.jav
a:1391)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:294)
at Sender2.eventOutput(Sender2.java:115)
at Sender2.mouseMoved(Sender2.java:96)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseMotionEvent(Component.java:5533)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3111)
at java.awt.Component.processEvent(Component.java:5257)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3905)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1766)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Now at the receiver side i use the following piece of code:
do
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
Integer x = (Integer) ois.readObject();
Integer y = (Integer) ois.readObject();
System.out.println("x: " + x);
System.out.println("y: " + y);
//ois.flush();
i++;
}while(i<2000);
and i get the exception:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:753
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
at Receiver.main(Receiver.java:19)
I need a method to continously send and receive data until the user terminates??? Is there any solution?? Plz suggest.

Similar Messages

  • I am receiving the data through the rs232 in labview and i have to store the data in to the word file only if there is a change in the data and we have to scan the data continuasly how can i do that.

    i am receiving the data through the rs232 in labview and i have to store the data in to the word or text file only if there is a change in the data. I have to scan the data continuasly. how can i do that. I was able to store the data into the text or word file but could not be able to do it.  I am gettting the data from rs232 interms of 0 or 1.  and i have to print it only if thereis a change in data from 0 to 1. if i use if-loop , each as much time there is 0 or 1 is there that much time the data gets printed. i dont know how to do this program please help me if anybody knows the answer

    I have attatched the vi.  Here in this it receives the data from rs232 as string and converted into binery. and indicated in led also normally if the data 1 comes then the led's will be off.  suppose if 0 comes the corresponding data status is wrtten into the text file.  But here the problem is the same data will be printed many number of times.  so i have to make it like if there is a transition from 1 to o then only print it once.  how to do it.  I am doing this from few weeks please reply if you know the answer immediatly
    thanking you 
    Attachments:
    MOTORTESTJIG.vi ‏729 KB

  • Can I use more than one blue-tooth device at the same time on IPhone 4S? Like a wireless headsets and speed and cadence sensor for cycling computer, receive the data and listen music simultaneously

    Can I use more than one blue-tooth device at the same time on IPhone 4S? Like a wireless headsets and speed and cadence sensor for cycling computer, receive the data and listen music simultaneously

    As long as the profiles are different (ex. HID vs AD2P) you will not have any issues. But say if you try to use 2 keyboards at once, it won't work. Or 2 headsets at once. Your scenario seems fine.

  • E-mail are received as DAT file instad of PDF

    Hi All,
    Please try to assist in this strange topic:
    When I try to send an e-mail via the SBO (press on the envelope button and choose u2018yesu2019 when
    the option u2018Would you like to attach an edited report to the e-mail?u2019 is display), the receiver is received a file with u2018DATu2019 extension and not with PDF extension and the receiver canu2019t open the file.
    I have tried to uninstall the acrobat reader 9 and install instead Foxit 3.1, but the problem still
    persists.
    In addition, I have found the this issue is reproduced only when the customer is using the Hebrew interface of SBO and the PDF file name is in Hebrew.
    When I switched to English interface of SBO, then the PDF file name is in English and the file is received correct (As PDF file).
    Another thing is that when you send the e-mail via the SBO (with the attached PDF) and open it
    on outlook (e.g. 2007), the file is received as DAT file,
    However If you open the e-mail on web mail (e.g. GMAIL), the file is received as correct PDF file, But when you send a regular e-mail (not via the SBO) with the attached PDF file and open it on outlook, the file is received As PDF file.
    Thanks,
    Erez

    I am afraid that there is a syntax or some codes in the interface that make the pdf converted into DAT file. You should ask the technical consultant or someone that developed the interface to make sure about it.
    If not, probably,  there is a problem with your current SAP B1 version. You could try to upgrade to the latest PL version of your current B1 application and then try again this case. if this is happened in the latest version, log a message to SAP Support.
    JimM

  • I am having problems interacting with Microsoft Office programs since the last update:cannot create a pdf through the 'print' menu in exel and both Word and Exel docs sent in Mac Mail end up being received as .dat files.

    I am having problems interacting with Microsoft Office programs since the last update:cannot create a pdf through the 'print' menu in exel and both Word and Exel docs sent in Mac Mail end up being received as .dat files.
    Both these situations have cropped up on my MacBook Pro since the last update.
    Thanks for your help.
    Cheers
    Bob

    The 'Winmail.dat' problem has been extensively covered in these forums, I would search for that (a Google search works well) and unfortunately I have not seen the pdf print problem before, but assuming the software is current and functions normally (other than the pdf print problem) I have no suggestion other than the obvious (but time consuming) re-installation of Office.
    I wish I had more

  • How to receive RTP data by JMF

    Hello!!
    I have a ipaq3870 installed Jeode.
    I can run JMStudio to play media on PDA and receive RTP data from PC's JMStudio.
    But I can't receive RTP data by AVReceive2.
    I compressed AVreceive2 into custom.jar.
    Can anyone teach me how to do?
    Did my steps correct?
    Thank you!!
    Shih-Wei Chen

    Hi,
    hope we could talk a little more about this because I am also trying to do some applications with the JMF and Personal Java / Jeode.
    So far I haven�t worked with the JMstudio but with the AVReceive and the AVTransmit classes. My Transmit-PC is a Desktop PC running Windows XP and my Receive Handheld is Sharp Zaurus with - as I said - Personal Java / Jeode running.
    Both classes run but the Transmitter only says "Transmitting ..." and the Receiver says "Waiting for data to arrive" and nothing happens.
    Perhaps you know what I am doing wrong ? Can it be the Windows XP - Linux ? But the JMF ist platform independent, isn�t it ?
    Do you think the JMStudio is better than the AVReceive ?
    How did you manage to run jmstudio under Jeode ?
    Of course he didn�t find the "java" exec because it is called evm but how can I change this ?
    Thanks for your help
    Poldi

  • Receiver based date transformation

    Hi,
    We have a scenario where we need to map the date to the  receiving databases. We have the same map going to oracle receiver and a mySQL receiver. The date formats of both the databases are different. How can this be handled within the same map ( like receiver based date transformation) or does it need to go throught the traditional route of different maps for different JDBC receivers? Any help is appreciated..
    Teresa

    Teresa,
    Yes, I have the same payload going across to both DB at the same time. THe payload to mySQL is failing because the date format is in oracle transformation. I was wondering whether this could be done without doing 2 different maps.
    Yes, you can do it in the same mapping.
    For two different receivers, you must be having two different Business Services? If yes, then get the values of receiver BS in your mapping and do a simple condition test. Apply the date transformation logic accordingly.
    For getting the Receiver Service name, you can either use the "Receiver" under "Constant" standard function or use the following UDF -
    String RcvService;
    java.util.Map map;
    map = container.getTransformationParameters();
    RcvService = (String) map.get(StreamTransformationConstants.RECEIVER_SERVICE);
    return RcvService;
    You can change the above code as per your requirement.
    Hope this helps.
    Regards,
    Neetesh

  • Why I receive Winmail.Dat instead of list of attachments with Email?

    I am receiving Winmail.DAT file as an attachment with email that contain large attachments. I can not view the Attachments, nor can I reterive this .dat file. How can I change the settings in MAIL. Any body can guide plz.?

    Mac OS X Mail: What is a winmail.dat attachment? : Apple ...
    Download TNEFs Enough for Mac - Extract winmail.dat ...
    Winmail.dat | OfficeforMacHelp.com
    How to Open Winmail.dat Files | Mac|Life

  • How i can receive & send data through port? urgent

    port=9999
    data receive in 4 column
    name, price, high, low
    i want to receive this data & display this data in from & automatic refresh
    do u have any idea ?
    plz urgent reply

    IDS (Internet Developer Suite) is a RAD tool to create database application however that totally depend upon your requirement but if u feels limitation while working on Form IDS , u can switch to Jdeveloper an open source environment but still u have option create bean in Jdeveloper as per your need and bundled it with your Forms.
    I still suggest to discuss the problems which you are facing while invoking the bean in your form so that we can guide u better.
    Finally, neither move to latest version or change your development platform just for seek of fashion
    Hope it clears now!

  • Sending & Receiving compressed Data

    Hi, How can i send & receive compressed data over a network using DeflaterInputStream and InflaterOutputStream, thanks.

    You probably would not use those classes directly, but GZIPInput and GZIPOutput stream instead. you would wrap those streams around the socket Input and Output streams at either end of a socket connection.

  • How to receive the datas?

    Look:
    the first I create socket sk:
    sk=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
    and I fill data into Ip Head and Icmp Head,
    then I sendto the packet,but I don't receive
    any datas:
    lenrecv=recvfrom(sk,buf,100,0,(struct sockaddr*)&addr,&rlen);
    my codes run at the function recvfrom,but it
    couldn't return variable lenrecv,and it look like down,
    I want to know why?how to receive the data?
    (I couldn't creat socket like this:
    sk=socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
    I want to know when I creat socket like this
    sk=socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
    How to receive datas?)

    Last edited by joseperezc (2012-08-14 18:58:22)

  • I2C with ARM embedded receiving incorrect data

    Hi together
    For a schools project, which I must finish until next week, I need to read out a DS1307 RealTimeClock via I2C.
    I am using a LM3S8962.
    I have tried to communicate via the NI USB-8451 module, which worked just fine.
    Now I only need to read out the Data from the DS1307 and I used the ARM embedded I2C VIs. I receive some data, but the Data is not correct (for example it shows a value of 70 in the seconds-register which is not possible).
    I've tried a lot of things but I couldn't get it to work properly.
    Attached a screenshot of how I implemented the reading of I2C. What am I doing wrong? I have really to get this working otherwise I can't finish my project and this would unfortunately result in a bad mark I hope someone can help me.
    Regards from Switzerland
    Dominic
    Solved!
    Go to Solution.
    Attachments:
    i2c_problem.JPG ‏46 KB

    Hi doh,
    are you sure you are reading from the right register? 
    According to this datasheet: DS1307.pdf , 
    if you want to access the seconds register it would be Adress 0 (Hex-Value-0), in your screenshot its 68 decimal. You can change the representation of your constant which is connected to the Adress terminal of your Create Configuration Reference VI. Just right click your constant -> visible object -> Radix. After that you can change the representation to x (HEX).
    Additionally when you read the 7 bits which are casted to 8 bit unsigned you have to notice that the 7 bits are encoded as BCD code.
    So consider your example reading the value 70: 70 in binary means: 100110 with the most significant bit on the left side and the least significant bit on the right side. Now when you split the values according to the seconds in the datasheets table:
    | 0 | 1 0 0 | 0 1 1 0  
    Then you will see, that 70 as U8 value has : 0110 = 6 (last 4 bits) and 100 (middle 3 bits) = 4, which means, that your actual value is not 70, but 46.
    So I would guess, you have to convert the U8 value to an Boolean array, split the bits according to the Table mentioned in the manual and then convert them to the proper time.
    Hope this helps, if you have further questions just post.
    With best Regards,
    Lam

  • Changing outlook 2013 contact so they will not receive winmail.dat files - missing settings

    trying to change email properties of a contact in outlook 2013 who keeps receiving winmail.dat from one of our guys , trying to get to internet format to change that setting.
    I have made the registry change suggested here http://www.slipstick.com/outlook/use-outlooks-contacts-contact-cards/
    but though I can get to properties now, I still do not see Internet Format.
    I do not even see it when I create a new contact.
    what am I missing?

    Hi,
    I'm marking the reply as answer as there has been no update for a couple of days.
    If you come back to find it doesn't work for you, please reply to us and unmark the answer.
    Best Regards,
    Steve Fan
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Get-WMI Object (0x800706F7) - The stub received bad data

    Hello there,
    i have an problem related to the above error..
    When i do a remote wmi call and pass the credentials like this (from an script)
    $passS =[ServerEye.PowerShellAPI]::Decrypt($pass)
    $securePass = convertto-securestring $passS -asplaintext -force
    $credential = New-Object System.Management.Automation.PsCredential("$domain\$user",$securePass)
    $buffer = gwmi -Query "select * from Win32_PerfFormattedData_MSExchangeRpcClientAccess_MSExchangeRpcClientAccess" -Credential $credential -Authentication Default -ComputerName $computer -ErrorAction Stop
    i sometimes get the above error with the stub received bad data...
    When i open a new powershell and do the wmi request it works.. When i close the powershell.exe and execute the above code again from the same script it works. But sometimes (totally) random this issue occurs for the existing powershell.exe process and will
    never go away till i close the process (which is not option, since i am using a deamon which runs script from a queue folder.. and this deamon runs for a long time.. 
    When i restart the server.. this issue never occurs for a long time but then suddenly reoccurs. 
    Anyone has an idea? I found one similar thread, but in this the solution was to pass the credential data in a server\user format or an domain\user format, which i am doing
    Is this a bug? Is this an scripting flaw from my side? What can i do against it... Any help would be really cool!!

    Thank you in advance for your answer. This is somehow what i expected..
    Sadly those are not our own servers. They are from a customer that is using our script to monitor several aspects.. and of course the software is always to blame :D (From a customer perspective).
    But i will inform the customer because this connection issue could be absolutly possible since i also see powershell sessions that get broken due to server communication..
    The only thing i really do not understand is, why it does not "repair" itselfs. What is the difference between closing the powershell.exe or simply re-executing the same get-wmiobject request..  I dont know how get-wmiobject manages its connection..
    but shouldn it do a new connection to the remote-server for each call?

  • Can't receive the data from my hardware device by LAN

    Hi!
    background:  For a testing task, I set up a hardware testing platform that including of a power supply device, a hardware to be tested(Device Under Test), a power Meter and a PC.   i build a program to control the hardwares, and they communicate with each other by LAN. at first, the program as a client can normally communicates with my hardware after initializing all hardwares. And then the program turns off the power of my device and turn on power again after delay 60 seconds. after initiantion, my hardware can execute the command which is received from the program, but the program can't receive the data from my hardware. Why my program cannot receive the data from my hardware, after the second time turn on the power of my hardware?  the program as client code as below:
    int CVICALLBACK ClientRRH (unsigned handle, int event, int error, void *callbackData)
      char temp[64]={0};
      int  ReceiveSize=0;
      char *Pos;
      switch(event)
       case TCP_DATAREADY:
        if( (ReceiveSize=ClientTCPRead (rrhHandle, readRRHBuffer, 4096, 2000))<0)
                     SetCtrlVal (panelHandle, PANEL_TEXTBOX_INFO,"Read RRH trace error!\n");  
                    return 0;
        else
         if (ReceiveSize>4096)
          readRRHBuffer[4096]= '\0';
           else
           readRRHBuffer[ReceiveSize] = '\0';
        if (Flag)
          Pos = strstr(readRRHBuffer,orderString);
          if(Pos)
           //strncpy(temp,(Pos+ strlen(orderString)),maxSize);
           _mbsnbcpy(temp,(Pos+ strlen(orderString)),maxSize); 
           sprintf(receData,temp);
           *temp=0;
           Flag=0;
           maxSize=0;
           *orderString=0;
        SetCtrlVal (panelHandle, PANEL_TEXTBOX_INFO,readRRHBuffer);
        *readRRHBuffer=0;
                break;
             case TCP_DISCONNECT:  
       rrhHandle =error;
                SetCtrlVal (panelHandle, PANEL_TEXTBOX_INFO,"TCP Clienterver has closed connection!\n");                 
                SetCtrlVal (panelHandle, PANEL_LED_RRH, 0);      
                break;
     return 0;
    int RRH_ini(char *RRH_address)
        ViChar Buffer[200];
        char temp[200];
        int status =0;
     if((ConnectToTCPServer (&rrhHandle, 7006, rrhAddr, ClientRRH, NULL, 1000)<0))
         SetCtrlVal(panelHandle,PANEL_LED_RRH,0);
        SetCtrlVal(panelHandle,PANEL_TEXTBOX_INFO,"Connection to RRH fail...\n");
         else
         SetCtrlVal(panelHandle,PANEL_LED_RRH,1);
         SetTCPDisconnectMode (rrhHandle, TCP_DISCONNECT_AUTO);
         sprintf(RRHCommand,"%s\n","asb");
         ClientTCPWrite (rrhHandle, RRHCommand, strlen(RRHCommand), 0);
         Delay(0.2);
         sprintf(RRHCommand,"%s\n","asb#1234");
         ClientTCPWrite(rrhHandle,RRHCommand,strlen(RRHCommand),0);
         Delay(0.2);
         SetCtrlVal(panelHandle,PANEL_TEXTBOX_INFO,"Connection to RRH successful!\n");
       return 0;

    Yes that's exactly my problem. The reader sends bytes but without a delimiter. So for example the greeting message I've mentioned earlier "iiAWID..." happens to be 32 bytes, therefore I made the following changes to the code:
    public void receive(int x){     // x = expected length of bytes being received
    boolean done = false ;
    int limit = x ;
    int counter = 0;
    try {           
    while (!done)
    if (in.ready())
    buffer.add(in.read()) ;
    counter = counter + 1 ;
    if (counter == limit)
    done = true ;
    }catch(IOException e) { // some code for handling}
    and this works fine, however, I'll probably have problems reusing this method later on, because some commands that I will send to the reader will result in responses of indefinite sizes. So I may have a response of length 12 one time and of length 8 the other. but between each response there's a maximum delay of 100ms... is there any way I can utilize that piece of information to improve my code?

Maybe you are looking for

  • HELP!!! 30 GB Video Ipod  not recognized by 2 computers

    I have 2 ipods. I has been unable to connect my 30 gb video Ipod to my laptop for a while. Today I installed a new 8gb ipod and it works just fine, even with the same cable, on my laptop. I tried all the "R" except general reset cause my other comput

  • Microsoft Excel cannot access the file "-". There are several possible reasons. Windows Server 2008 R2 with Microsoft Office 2010

    I have a problem with starting the Excel Application under a particular user (service account). I try to schedule this C# script through an application X (not Windows Task Scheduler. And this application will always use a service account to run servi

  • Bridge opens Raw thumbnails but not Preview?

    In Bridge I can open Raw files from my Canon 6D as thumbnails but not as the large Preview. The files will open in Camera Raw 8.1 with no problem. I have Photoshop CS6 13.0, and Bridge 5.0.0.399. I am on a Mac Pro OS 10.8.4 What can I do?

  • Crystal Reports in Hyper-V

    I have an application developed in VS2003 with CR XI. The application is installed on a machine Windows Server 2008 and works properly. When moving the machine where I have the application installed to Hyper-V or install my application on a machine t

  • Create a dictionary managed tablespace  error.

    When I use the following script to create a tablespace. create tablespace DATA01 datafile 'c:\oracle\oradata\orawin2k\U04\data01.dbf' size 2M EXTENT MANAGEMENT DICTIONARY; But the oracle return this error. ORA-12913: Cannot create dictionary managed