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?

Similar Messages

  • Who worked with ICS' Model 4896 GPIB? I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    Hello. Most of the engineers in developer exchange are more familiar
    with NI products. Contacting ICS for technical support is a better
    course of action.

  • Unfortunately, I lost by an update all the apps on my iPad 2. Now I can not pull the data from the cloud to my iPad. How is this possible?

    Unfortunately, I lost by an update all the apps on my iPad 2. Now I can not pull the data from the cloud to my iPad. How is this possible?

    If you just installed iCloud does that mean you updated the iOS that's running on your iPad?  If so, you'll want to restore all the programs you have from the backup you hopefully made.
    Refer to these articles for help.
    iTunes: Backing up, updating, and restoring iOS software.
    If you don't want to use iCloud, simply don't activate it.
    You can also download the programs again.
    If you live in a country that supports re-downloading apps then you can re-download them.  You can refer to this article for more help.
    Downloading past purchases from the App Store and iTunes Store
    What to know if your country supports downloading past purchases?
    iTunes in the Cloud Availability

  • How Can we get the data from Non-SAP to SAP in WebDynpro

    Hi,
    I hope u understand my query, How can we get the data from Non-SAP to SAP thru WebDynpro Programming.
    Help out with the steps for getting the data or procedure.
    Regards,
    Mutyapu

    You can expose the APIs in the Non-SAP backend as Web Services, and consume them in SAP by creating an Enterprise Proxy. Then these can be called just like normal class methods from Web Dynpro.
    Regards,
    Nithya

  • How can I acquire the data from 3 separate Channels of SCXI1300 simultaneously?

    I am trying to build a DAQ system, which can collect the data coming from 3 different channels. I am using the SCXI 1300 board, Labview 8.0. I used 3 separate DAQ Assistant module to build the system, but it can not collect the data from the 3 channels simultaneously, it can only collect the data from one channel by another channel. So I am wondering how could I fix this problem or rebuild my system.  Thanks

    Hi, Dennis
    I tried to use the NI-DAQmx to replace the DAQ Assistant to do the 3-channel data acquisition simultaneously, and I did the signal splition as you told me. The program works fine for 1-channel data collection, but if I chose 3 channels to do the data acquisition simultaneously, the program could not wokr, and  a warning window  kept poping up, and the window tells me the maximum sampling frequency is 0.952. So I am wondering what is going wrong and how to fix it.
    The attached files are the code and the screen shot of the warning window, please check them.
    Thanks
    Jingrui
    Attachments:
    NI-DAQmx program.vi ‏165 KB
    Warning Window.jpg ‏2305 KB

  • How can we export the data from OAF Page to Excel instead of .csv or .txt

    Hello,
    How can we export the data from OAF Page to Excel instead of .csv or .txt
    When i click on the export button it is exporting to txt file, But i need to export the data into Excel by default
    Please help me
    Thanks in advance
    Thanks,
    Raju
    We have changed the below profile option to get the data in excel by default
    Profile Name Export MIME type
    Profile Code FND_EXPORT_MIME_TYPE+
    Existing Value: text/tab-separated-values+
    Change as: Excel
    Thank you,
    Raju
    Edited by: 1006649 on May 21, 2013 10:55 AM

    We have changed the below profile option to get the data in excel by default
    Profile Name Export MIME type
    Profile Code FND_EXPORT_MIME_TYPE+
    Existing Value: text/tab-separated-values+
    Change as: Excel
    Thank you,
    Raju

  • How can i convert the data from mutiple-table to the other database(MSSQL)?

    Dears,
    How can i convert the data from mutiple-table to the other database such as MS-SQL?
    I have a third party system based on MS-SQL 2000.
    Now we want to make a integration between SAP R/3(Oracle) and SQL server.
    When my user releases the purchase order in R/3, the application we coded will convert the releated data to the temp database on the SQL server.
    But i don't know which tools will help me reach the purpose.  BAPI, LSMW, IDoc... ???
    Would anybody tell me which way is better and how to do?
    Thanks a lot!
    Kevin Wang

    Hello Kevin,
    The question to use which method depend on your detail requirements. If you use BAPI, you need to find which Bapi can provide the data you want. Bapi normally use as a function called by external system. So you need to develop an external program like VB/Java to call this Bapi and move it to SQL. LSMW is use when you want to upload data from an external system to SAP. So it does not serve your requirement. Idoc can be use to export data to an external system. Again like Bapi, you need to find what Idoc can provide the data you want. However, it does not any programming from the external system. If I were you, based on your requirements, I think writing an Abap program that read the data you want and download it to NT/SQL server will be faster and easier.

  • How can i save the data from the Oracle database to my local directory

    How can i save the data from the Oracle database to my local directory instead Of saving the data file to the Directory created on the Oracle Server ?
    I require to design the Procedure which will pull the data from various tables and needs to store the data in the Client's local directory.

    Since SQL*PLUS runs on the client, you can use SQL*PLUS to spool data to your local drive.
    You could also use the database to write a a specified drive where all users have access to (mapped network drive, e.g.). I wouldn't recommend doing it that way, but it is sometimes useful when the files are created in some nightly batch run.

  • How can I extract the data from Xstring .

    Hi Gurus ,
    How can I extract the data from a XSTRING  .
    I have to get the data which is filled in the survey form the data is getting saved in form of xstring .
    Someone told me that there is a standard FM for that . but I am not able to find .
    Please reply with the FM in case some one knows about it .
    Thanks in advance .

    The following code works as of 7.0 (in any SAP system):
    FORM XSTRING_TO_STRING USING input TYPE xstring CHANGING output TYPE string.
    TYPES : BEGIN OF ty_struc,
              line TYPE c LENGTH 100,
            END OF ty_struc.
    DATA lt_char TYPE TABLE OF ty_struc.
    DATA length TYPE i.
    length = xstrlen( input ) / cl_abap_char_utilities=>charsize.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = input
      tables
        binary_tab            = lt_char.
    CONCATENATE LINES OF lt_char INTO output RESPECTING BLANKS.
    output = output(length).
    ENDFORM.
    Edited by: Sandra Rossi on Mar 30, 2010 12:24 AM

  • Can i recover the data from a broken XD card?

    Can i recover the data from a broken XD card? any software Power Data Recovery. but it failed

    Accidentally deleted data from XD card, don't panic. I suggest an advance and professional XD card recovery software, you can use third-party software Kernel for Digital Media Recovery Tool. It can quickly restore all lost data from XD card. This software
    also supports all kinds of multimedia files such as SD Card (Secure Digital), Multi Media Card (MMC), Compact Flash (CF), XD Card, Micro SD card, , Memory Stick. To more details kindly read this post : http://digitalmediarecovery.blogspot.com/2013/12/retrieve-lost-data-from-memory-card.html

  • How can i store the data from the list to MS-Access?

    Hi all,
    We all know that from alv it is possible to export data to Ms-excel or word or text file. Can anyone tell me how can i store the data from alv or reports to Ms-Access?
    Thanks in Advance,
    Abhijit

    Hi,
    If you want that without code, i suppose there is a option in MS-Access to import data from Excel, so you have to first export to excel and then import to Access.
    If you want to code it yourself then have a look at FM TABLE_EXPORT_TO_MSACCESS, as said in Exporting Data from R/3 to MS ACCESS
    You can also see the search results in SCN for [export data to MS-Access (45 Results)|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=exportdatato+MS-Access&cat=sdn_all].
    Regards
    Karthik D

  • I have Time Machine that I used to back up my old computer. It was running snow leopard. My MacBook died, so I got a new one which is running Lion.  how can I restore the data from the time capsule to my new Mac?

    I have Time Machine that I used to back up my old computer. It was running snow leopard. My MacBook died, so I got a new one which is running Lion.  how can I restore the data from the time capsule to my new Mac?

    In technical support, sometimes you have to make educated guesses. I'm sorry that you were offended.
    iTunes does prompt when it is going to erase a device, and the message is clear.
    She said in her message that she was able to successfully sync the old ipad. This indicated to me that itunes wiping the data was not an issue, because either it had been setup at the apple store (in which case it doesn't actually wipe the ipad despite saying it will*) (*based on a single case I saw), or because the itunes media folder was migrated.
    Furthermore, my solution was to tell her how to backup her ipad (by either doing it manually, or as a last resort, by deleting the corrupt backup -- that she couldn't access anyway.)
    I got that last part of the instructions from the "Taking Control of your iphone" book which I found samples of when I did a google search for "corrupted backup itunes".
    She marked this as a solution, so it worked for her.

  • I removed my SSD card from my broken macbook, how can I transfer the data from it to another computer?

    I removed my SSD card from my broken macbook, how can I transfer the data from it to another computer?  I have an iMac now or a PC. 

    You can put it into any notebook SATA enclosure such as Build your own External/Add your own drive up to 1.5TB! OWC Express USB 2.0 Express Kits From $18.79 USB 3.0 Express Kits From $21.99.

  • SCM APO can we copy the data from client 001 to client 002???

    Hi Guru's
    SCM APO can we copy the data from client 001 to client 002???
    If it is possibulity please let me know?
    Regards,
    Sree

    Yes you can do.
    Tcode SCCL.
    Options :
    When copying clients, you can select what you want to transfer from the source client to the target client:
    User masters: You select this option, for example, if you want to give all users of an existing client the same authorizations in the target client.
    Client-specific Customizing: You select this option, for example, if you want to set up a new client in an existing system.
    Client-specific Customizing and master/transaction data:
    You select this option, for example, if you want to set up a test client that is identical to the production client (in the same system).
    Client-specific and cross-client Customizing: You select this option, for example, if you want to set up a quality assurance system based on the production client of another system.
    Client-specific and cross-client Customizing and master/transaction data: You select this option, for example, if you want to set up a test client based on the production client of another system.
    http://help.sap.com/saphelp_46c/helpdata/EN/69/c24c4e4ba111d189750000e8322d00/frameset.htm

  • HT201269 can i backup the data from a broken iphone to my new iphone?

    can i backup the data from a broken iphone to my new iphone?

    Just back the phone up to icloud and restore iPhone from backup on the new phone. When you are going through the set up process it ask you if you want to set the phone up as new or restore from a backup. You do not nee itunes at all or anything hooked up.

Maybe you are looking for

  • Game Center going Crazy!

    So I have had the same apple ID account for almost three years now and I have downloaded many games over that time. I go a lot on game center to check all my game stats and so on. So one day I go onto game center as I do normally and click on games a

  • Empty File has to write after Message Processing in File Adapter..!!

    Hi, File to File Scenario. Once the file is processed and placed in the receiver folder, I need to generate one empty file with the original file name but with different extension (DON). This is used to indicate that the full file is written in the f

  • Camera raw 4.0 instilation

    I am trying to install the camera raw 4.0, however I keep getting this pop up message that says to shut down the applications of PhotoshopElementsFileAgent.exe I have closed out all of my programs but this still appears. I have elements 6 & photoshop

  • Using Pre Plus as a modem with laptop

    Can I use the Palm Pre Plus as a modem tethered to my laptop with VZ Access Manager software from Verizon.  I used this method before with my Blackberry Pearl ($15/mo).  I don't want to pay $40/mo to Verizon to use WiFi (Mobile hotspot) feature on Pa

  • BDC for Product master

    Hi Gurus, I am implementing CRM 5.0 standalone in a Bank. Here I need to upload product master thru BDC. There is some text in each product master which I am trying to maintain in "Basic Text" in View "Financing" . Now when I am recording thru SHDB b