Urgent: get only half-data from InputStream

Hello,
I am using a client socket (java code) to get the data from server socket(Perl code), the getInputStream( ) get only the half-data from server. For example: the data in server is 12345678, what the client to get is 1357.
Both socket use stream socket, tcp protocol,
inBuffer = new BufferedInputStream(misClientSocket.getInputStream());
while( (ch=inBuffer.read()) != -1 ){     
System.out.print((char)inBuffer.read());
or System.out.print((byte)inBuffer.read());
even if I don't use BufferedInputStream, directly to use InputStream.read( ), it also get half-data.
Please help me to know what is wrong!!!
Thanks
Lixin

You just get every other byte because you call inBuffer.read() twice each time : once in the while condition then once in the while body. Just try this :
inBuffer = new BufferedInputStream (misClientSocket.getInputStream());
int ch;
while( (ch=inBuffer.read()) != -1 ){
System.out.print((byte)ch);
} Matthieu

Similar Messages

  • Downloading problem::getting only partial data from the net, why ??

    hi
    i am trying to download a file using the code
    InputStream getStream(){
    try {
    URL url = new URL("http://www.etc..");
    URLConncection urlconn= url.openConnection();
    InputStream in =urlconn.getInputStream();
    return in;
    }catch(MalformedURLException ){...}
    catch(IOException ioe){...}
    the problem is it is not getting the complete data.
    i tried to download a file which is 46k but it got only 1.3k
    can any one tell what to add or modify the above code so that i will be getting the complete data
    thanks in advance
    have a nice time
    krishna
    email id:[email protected]

    Try to set the request property and usecaches like
    this:
    con.setUseCaches(false);
    con.setRequestProperty ("Content-Type",
    "application/octet-stream")
    not working, i tried to download 46663 bytes got only 1369 bytes,please suggest me another solution.
    thanks in advance
    krishna

  • How i can get only required data from table by using CKM

    Hi...
    i have done one scenerio i.e get required data from one table into another table on basis of some condition by using CKM.
    Now i want same,but this time my target is file ,not RDBMS.
    so plz tell me procedure how i can get required data from source table into File on basis of some condition using CKM.
    thanks

    CKM checks for Constraints and Not Null condition. You can use IKM SQL to File and being that there is no option in IKM for CKM .
    The other method is you can declare those Not null and other condition as Filter in the Source Datastore, that should filter out records that you are not willing to move to files.

  • GetParamter("") gets only half portion of String...

    I am using jni to retreive data from database and use jsp to view in webpage...
    When i use request.getParameter("name");
    I am getting only half of my name String. i.e. If the name is John Smith, I am retreiving only John and no Smith :(
    But when I print the value from by bean where I get the Database value I am seeing John Smith, only this JSP page is not displaying the full name...
    Any hight lights are appreciated.
    Thanks in advance.

    Are you looking something like this to display the error stack on the browser itself...!!!!
    try{
            //code which throws exception..
    }catch(Throwable theException)
         out.println(stackToString(theException) ;
         private static synchronized String stackToString(Throwable aThrowable) {
              try {
                   ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
                   PrintWriter pw = new PrintWriter(byteStream, true);
                   aThrowable.printStackTrace(pw);
                   pw.flush();
                   pw.close();
                   byteStream.flush();
                   byteStream.close();
                   return byteStream.toString();
              } catch (Throwable ex) {
                   return aThrowable.toString();
         }hope it may help you...

  • How to only migrate data from SQL Server 2008 to Oracle 11?

    According to our requirement, We need to only migrate data from a SQL Server database to an existed
    Oracle database user.
    1) I tried to do it with SQL Developer 3.0.04 Migration Wizard, But find an issue.
    My SQL Server database name is SCDS41P2, and my Oracle database user name is CDS41P2;
    When I used SQL Developer to do offline move data by Migration Wizard, I found all oracle user
    name in movedata files which gotten by run Migration Wizard
    is dbo_SCDS41P2. If the Oracle user name is not the same as my existed Oracle user name,
    the data can't be moved to my existed Oracle user when I run oracle_ctl.bat in command line window.
    So I had to modify the Oracle user name in all movedata files, but it's difficult to modify them because there are many tables in
    databases. So could you please tell me how to get the movedata files which the oracle user name in them is my
    expected Oracle user name?
    2) I also tried to use the 'copy to Oracle' function to copy the SQL Server database tables data
    to the existed Oracle database user. When clicked 'copy to Oracle', I selected 'Include Data' and 'Replace' option
    But I found some tables can't be copied, the error info is as below:
    Table SPSSCMOR_CONTROLTABLE Failed. Message: ORA-00955: name is already used by an existing object
    Could you please tell me how to deal with this kind of error?
    Thanks!
    Edited by: 870587 on Jul 6, 2011 2:57 AM

    Hi,
    Thanks for you replying. But the 'copy to oracle' function still can't be work well. I will give some info about the table. I also search 'SPSSCMOR_CONTROLTABLE' in the target schema, and only find one object. So why say 'name is already used by an existing object'? Could you please give me some advice? Thanks!
    What is the 'Build' version of your SQL*Developer ?
    [Answer]:
    3.0.04
    - what does describe show for the SPSSCMOR_CONTROLTABLE in SQL*Server ?
    [Answer]:
    USE [SCDS41P2]
    GO
    /****** Object: Table [dbo].[SPSSCMOR_CONTROLTABLE] Script Date: 07/18/2011 01:25:05 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[SPSSCMOR_CONTROLTABLE](
         [tablename] [nvarchar](128) NOT NULL,
    PRIMARY KEY CLUSTERED
         [tablename] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    - what does describe show for the SPSSCMOR_CONTROLTABLE in Oracle ?
    [Answer]:
    -- File created - Monday-July-18-2011
    -- DDL for Table SPSSCMOR_CONTROLTABLE
    CREATE TABLE "CDS41P2"."SPSSCMOR_CONTROLTABLE"
    (     "TABLENAME" NVARCHAR2(128)
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ;
    -- DDL for Index SYS_C009547
    CREATE UNIQUE INDEX "CDS41P2"."SYS_C009547" ON "CDS41P2"."SPSSCMOR_CONTROLTABLE" ("TABLENAME")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ;
    -- Constraints for Table SPSSCMOR_CONTROLTABLE
    ALTER TABLE "CDS41P2"."SPSSCMOR_CONTROLTABLE" MODIFY ("TABLENAME" NOT NULL ENABLE);
    ALTER TABLE "CDS41P2"."SPSSCMOR_CONTROLTABLE" ADD PRIMARY KEY ("TABLENAME")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ENABLE;
    Edited by: 870587 on Jul 18, 2011 1:42 AM

  • I lost my iphone. How can I get my saved data from back up on my new laptop?

    Dear Friends,
    I did a mistake as when selling my iphone I did not get my saved data from my iphone back up. Now I have a new laptop and I want to get my backed up data.
    Is there any way I could get or as Apples traditional greed ... more money more money ...more .. more??????
    Please help if I can get back my at least contacts and video for free. I do not are for my music. My God it is so difficult to get going with Apple.

    stedman1 wrote:
    A warranty does not cover physical damage. Did you have AppleCare +?
    AppleCare+ doesn't cover loss or theft, only accidental damage.

  • Is there any way to get specific app data from iCloud so that when you redoes load an app, you can restore its data?

    Is there any way to get specific app data from iCloud so that when you redoes load an app, you can restore its data?

    no.
    the backup is only for the purpose if you need to wipe the device.

  • Not able to get the Qualification data from BAPI

    Hi all,
    I am using a BAPI (BAPI_JOBREQUIRE_GETLIST) to get the qualifiaction data for requirement profile. It's working fine earlier but I did not get the qualification data from this BAPI, although the data is there in DB against this requirement profile.
    Can someone suggest me why I am getting this issue. I have looked into SDN and in BAPI documentation and found as below:
    "You require authorization (structural authorization) to read the Requirements subprofile."
    I am having the same User ID as I had before (when I getting back the correct data), so I don't think it should be authorization issue.
    Can someone help me out in this issue please.
    Thanks,
    Sanket Sethi

    Hi Shiva,
    It does not going to these includes at all. Message comes out with successfully done. The BApi is calling RHPP_COMMON_QUALI_READ inside, but this will not return any data. But if will call any qualification object ID, this BAPI will come up with data.
    So the QP type LO profile will not come up with any kind of data, but if we pass the OTYPE as Q and pass any Qualification object ID then the data will be returned.
    Is there any relationship or some other thing is missing? Any idea.
    Thanks,
    Sanket Sethi

  • I'm getting a "No Data From Device" error for older video import

    I'm trying to create digital video archives of some older (Hi-8) tapes before they turn to dust.  I've got a Sony deck with iLink and have been using iMovie, which is time consuming but error free.  I want to use the "Create Camera Archives" feature in FCP X, but am not able to import any video. FCP recognizes the deck, lets me control it and displays video in the capture window.  But it does not capture anything - camera archives are empty and when I try to import the video I get a "No Data from Device" message over the import window, as the video is playing in the background.  I thought it might be an issue of import settings... but I can't find any to change.
    Any advice appreciated. Thanks.

    Make sure all your settings are correct for capture and playback. Also make sure that the settings on the deck are the same as well. I know I had an issue when my Sony FX1 HDV camera was set to DV, FCP gave a similar error message.

  • TS1474 I have a new PC - great.  But the old PC has now gone and taken the backup of my iPhone 4S with it.  How do I get all my data from my iPhone to a new copy of iTunes on the new PC?

    I have a new PC - great.  But my iTunes library has now gone with the old PC.  With a new iTunes library how do I get all my data from my iPhone to a new copy of iTunes on the new PC?

    It has always been very basic to always maintain a backup copy of your computer.
    Have you failed to do this?

  • Variant must get the current date from the system.

    Hi All,
    I really appreciate your help on below please;
    I need to create a variant and schedule a report program once a day.
    But variant must get the current date from the system (sy-datum).
    The program should run for the values in the variant in schedule job run;
    Can I do this using SAP variants (for Report Program) and schedule the job.
    Many thanks
    Iver

    Standard functionality.
    http://help.sap.com/saphelp_nw70/helpdata/en/c0/98039be58611d194cc00a0c94260a5/frameset.htm
    Thomas

  • How to get only the date without the time in the footer of a printout?

    Is there a way to get only the date without the time in the footer of a printout?

    As far as I can tell, there's no built-in option to get the date printed without the time. It's hardcoded in a C++ file.
    As a workaround, you can enter custom text for the footer, but it would need to be updated every time the date changed. I can think of a couple ways to automate that:
    * An add-on (but I'm not aware of any add-on for this)
    * External process to push a new date into prefs.js, a settings file that stores your header/footer preferences, among others (but Firefox should be closed when you update this file, and it will be read when you restart)
    Not easy enough, I know.

  • "Could not get the audio data from the file" error

    Hi
    I get a lot of "Could not get the audio data from the file" errors when opening a project. Sometimes they crash Premiere Pro CC 7.01 (Mac). But if not Premiere works as usual, with the audio.
    I tried to convert the audio files (coming from Audition) from 32 to 16 bit. It worked while opening a project once, but not the following times.
    Where can it come from ?
    Edit: I also get this error when importing audio: "Error: Premiere Pro version 7.0 is not compatible with the Premiere Pro Plug-in version 5.7.4". Maybe it is connected.

    Got it! It was the Smartsound plugin making trouble. Got rid of it and no more errors.

  • How i cen get back deleted data from the bin?

    how i cen get back deleted data from the bin?

    Not once you have put the data in the trash and pressed the button to delete it.
    There may be some hope if you can understand what I am telling you in my first post to you.
    Time machine is too complex to explain in this kind of post but I am giving you five links below which should explain quite a lot.   There are no formal instruction manuals for Time Machine.
    Time Machine Tutorial
    Time Machine 101
    How to back up and restore your files           This in particular
    Time Machine Features
    Apple - Support - Mac OSX v10.5 Leopard Time Machine

  • URGENT! Getting the correct data from field BET01 in Infotype 0008

    Hello,
    I am trying to read the logs (Long-term PCL4) for the field BET01, BET02...in infotype 8. When I get the data from the logs, the value that appears in BET01 seems to be different from the value present in PA0008.
    Does this value depend on the wage types valuation? How is this value in the logs calculated? For the same amount present in pa0008-bet01 and for same wage type, i am seeing a different amount coming up from logs. Could anyone please help me with this to understand how the value in logs is being calculated?
    Thank you very much !

    If two users run the same select at the same time, they will ALWAYS come up with a duplicate doc code.
    The standard way to insure a unique code is to use an Oracle sequence.
    Otherwise, you could build your pl/sql into a stored procedure or package that inserts the new document code into the table before it passes it back to the user. This would prevent the second user from getting a duplicate, but would also stop user 2 from even getting a document code until user 1 did a commit.

Maybe you are looking for

  • I got error in installation of SAP 4.7 please check and suggest

    Error in saplicense. is there any file i have to change or modified durint the installation phase.

  • Unknown xml tag extraction

    I have an XML document with the following structure: <foo>      <foo id="F1">television</foo>      <foo id="F2">car</foo> </foo> foo id can be none or up to 99. So I want to extract the tag "F1", "F2", etc. and its content when it shows up in a docum

  • How do I create a subset in my slideshow?

    How do I choose ten individual slides from my keynote presenter slideshow to create a new slideshow from my original sjideshow?

  • Budget effected for current year for changing a PO of last year

    Dear Controlling firends, I am a MM guy and facing the titled difficulty. The problem is ,suppose a Po had been created in last fiscal year and at that time budget for last year has been consumed as committed. But now when I am changing that particul

  • Mac/Unix path differences causing linking problems?

    At our organization, we have a single monster Xserve running Mac OS X 10.6.7 and Aqua Connect where up to 15 users log in concurrently with different UI sessions and work on pages using InDesign CS3 and CS5. Each user mounts the same AFP sharepoints