TCP socket trouble, anyone can help?

I'm in the process of developing Java program that connects to a remote server process, TCP/IP, writes data and then waits on, reads, and displays the response. I've got a strange problem:
When I do the initial write, using DataOutputStream.writeBytes( ), there seem to always be two packets generated. A one-byte packet containing the first byte of my buffer, and then an <n>-byte packet containing the remaining bytes of my buffer. I've tried setting the TCP_NODELAY to 'false', without success. Any ideas? Any way to get around this (extra packet is a waste)?
Roman
shainsky (at) mail (dot) ru
ICQ: 1327456651

how you read it back ?
if you using
read(byte [] b)
then, get the total number of byte read
example,
byte [] b = new byte [10]
int i = yourdatainputstream.read(b);
String newString = new String(b, 0, i);

Similar Messages

  • I have trouble to log in facetime with my Mac air. Is anyone can help?

    I have trouble to log in face time with my Macbook Air. Is anyone can help?

    Hi kho99,
    Can you elaborate on the issue a bit? What error message(s) are you receiving? Does the application start up properly? Is it accepting your credentials? Is there any issue initializing the camera, video stream or audio?
    More information and specifics but be very helpful in provide next steps.

  • Please help error -9808 when downloading apps in itunes store anyone can help me out

    please help error -9808 when downloading apps in itunes store anyone can help me out

    Click here >  iTunes: Advanced iTunes Store troubleshooting
    Then "expand" Specific Conditions and Alert Messages
    Then click 9808

  • I use "hdmi to component converter" to connect apple tv with my old plasma tv by component cable. Sound is ok but the picture split 2screens left and right. Still can't fix it. Anyone can help or has any idea? should I try convert to av?

    I use "hdmi to component converter" to connect apple tv with my old plasma tv by component cable. Sound is ok but the picture split 2screens left and right. Still can't fix it. Anyone can help or has any idea? should I try convert to av?

    Your TV hasn't entered some odd picture in picture mode has it with  two 'inputs' side by side?
    AC

  • Unable to play video onto my Samsung LCD TV when using a Memorex Mini Soundbar MA5004. Anyone can help?

    Unable to play video onto my Samsung LCD TV when using a Memorex Mini Soundbar MA5004. Anyone can help?

    Does anything go to the TV? Like can you hear audio?
    Dod it ever work?
    Does it work with other display devices?
    You are using an app that supports TV out?
    What does the soudbar have to do with it? 

  • My ipad is hung what to do?i cannot switch off for 2 weeks because of i cloud it say full and cannot be back up i try to close or open the settings but nothing happen anyone can help me thanks a lot in advance

    my ipad is hung what to do?i cannot switch off for 2 weeks because of i cloud it say full and cannot be back up i try to close or open the settings but nothing happen anyone can help me thanks a lot in advance

    Welcome to Apple Support Communities
    Hold Sleep and Home buttons for 10 seconds until the device restarts

  • In this report i have marked one line..if this width 30,i need to multiply by a number 0.3 and if the width =30,it multiplies by 0.37...how to use this logic here..??? anyone can help??

    In this report i have marked one line..if this width < 30,i need to multiply by a number 0.3 and if the width >=30,it multiplies by 0.37...how to use this logic here..??? anyone can help??
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @SCCode nvarchar(30)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    --Rcpt from PRDN (Condition checked for Return component exclusion also)
    SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
    T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'FG Item Code',
    T3.ItemName as 'FG Item Name',
    T2.PlannedQty as 'FG Planned Qty',
    T2.U_OD as 'OD',
    T2.U_ID as 'ID',
    T2.U_OD/25.4 as 'Inches',
    (T2.U_OD-T2.U_ID)/2 as 'Width',
    0 as 'FG Pending Qty',
    0 as 'FG Receipt Qty',
    '' as 'Issue Item Code',
    '' as 'Issue Item Name',
    Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
    0 as 'Issue Item - Return Quantity',
    '' as 'Return Doc No',
    SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
    SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
    from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
    INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
    LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)
    LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntry
    WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
    GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2
    UNION ALL
    SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
    T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'Item Code',
    T3.ItemName as 'Item Name',
    T2.PlannedQty as 'Planned Qty',
    T2.U_OD as 'OD',
    T2.U_ID as 'ID',
    T2.U_OD/25.4 as 'Inches',
    (T2.U_OD-T2.U_ID)/2 as 'Width',
    (Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',
    (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
    a.ItemCode as 'Issued Item Code',
    a.Dscription as 'Issued Item Name',
    Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
    (Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
    (ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
    SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
    SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
    from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
    INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
    LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
    LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry 
    WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
    GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription    order by T2.DocNum desc

    Hi,
    Try this:
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @SCCode nvarchar(30)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    --Rcpt from PRDN (Condition checked for Return component exclusion also)
    SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
    T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'FG Item Code',T3.ItemName as 'FG Item Name',T2.PlannedQty as 'FG Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) <30 then ((T2.U_OD-T2.U_ID)/2) *0.3 end, 0 as 'FG Pending Qty',0 as 'FG Receipt Qty','' as 'Issue Item Code','' as 'Issue Item Name',Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',0 as 'Issue Item - Return Quantity','' as 'Return Doc No',SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntryINNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCodeLEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntryWHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2UNION ALL SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,T2.DocNum AS 'WorkOrderNo',
    b.DocNum as 'Issue Doc No',
    ISNULL(d.DocNum,'') as 'Receipt Doc No',
    b.U_IssPSCName as 'SubContractor Name',
    T2.ItemCode as 'Item Code',T3.ItemName as 'Item Name',T2.PlannedQty as 'Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) >=30 then ((T2.U_OD-T2.U_ID)/2) *0.37 end, (Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',(Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
    a.ItemCode as 'Issued Item Code',
    a.Dscription as 'Issued Item Name',
    Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
    (Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry
    where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
    (ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
    SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
    SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
    from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
    INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
    LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
    LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry
    WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
    GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,
    T2.PlannedQty,T2.U_OD,
    T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription  
    order by T2.DocNum desc
    Thanks & Regards,
    Nagarajan

  • In Lion, sometimes clicking on close button or tabs doesn't respond as if the buttons aren't there, i have to move the cursor away and move back to make them work again, anyone can help me?

    I'm not sure if anyone had run into this issue. Clicking the same place on the display sevral times will cause the click to stop working. For example, if i open safari and click on the Show Reading List button, it will work the first time i click it, but stop responding to my command as i click more, as if the button is not there, i have to move away the cursor and click somewhere else and move back to click the button to make it work again. And it happened everywhere, not just the show reading list button. The scrolling and moving are normal.
    In fact, I have my trackpad replaced in an apple store for this issue but it turned out this is not a hardware problem, and it is not only my problem. Ironically, i found the same issue on several of the demo Macs inside the apple store. So anyone can help me here? Thanks.

    Hi manni394, what version of Firefox are you running now?
    Firefox 22 has a new way of setting the default zoom level: it is based on your Windows font size setting. So, if you set Windows fonts to 125% (enlarged 25%), your Firefox pages also will be enlarged 25%. On pages that do not adjust their layout, you may get a horizontal scroll bar.
    To reduce the zoom on a page, hold Ctrl and tap the - key (the one on the numeric keypad or the one on the number row of the keyboard). The zoom should be reduced for each tap.
    If you want to globally adjust your zoom level to be lower, you can use either of these add-ons:
    * [https://addons.mozilla.org/firefox/addon/default-fullzoom-level/ Default FullZoom Level]
    * [https://addons.mozilla.org/firefox/addon/nosquint/ NoSquint]
    If you already have one of those add-ons, check the default/global zoom level in case it needs to be adjusted.

  • I have an ipod touch and it is disabled cause my cousin changed the password and forgot what it is so now it is stuck .. i connected it to the itunes but still the keypad didnt appear and couldnt remember the password.. anyone can help me ?

    i have an ipod touch and it is disabled cause my cousin changed the password and forgot what it is so now it is stuck .. i connected it to the itunes but still the keypad didnt appear and couldnt remember the password.. anyone can help me ?

    Place the iPod in Recovery Mode and restore via iTunes.
    iOS: Wrong passcode results in red disabled screen
    If not successful, try DFU mode.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • I am using iPad 3 and I try to use 30-pin Digital AV adaptor for mirroring on my Samsung HD TV.  Unfortunately it is not a full screen projection.  Anyone can help?

    I am using iPad 3 and I try to use 30-pin Digital AV adaptor for mirroring on my Samsung HD TV.  Unfortunately it is not a full screen projection.  Anyone can help?

    The iPad Screen is almost square, HD TVs are rectangular so will never be full screen.  When watching movies, the movies native aspect ratio will be used rather than the iPads screen aspect ratio so will look full screen if the movie is full screen, but most likely will be seen in wide screen letter box format. with black bars across the top and bottom as that what most movies from iTunes are in, format wise

  • I forgot my icloud id and password. i want to delete the id. i forgot the password. if i try to delete the account its asking for password. i cannot find how to delete the account. Please anyone can help me out???

    I forgot my icloud id and password. i want to delete the id. i forgot the password. if i try to delete the account its asking for password. i cannot find how to delete the account. Please anyone can help me out???

    You aren't going to be able to delete it without the correct password.  If it's your ID, you can reset the password as explained here: http://support.apple.com/kb/HT5625.  If it isn't your ID, you will have to get the password for the person who owns the ID.  There's no way around this and no one else can help.

  • Hello i forgot my i cloud password..anyone can help me to find my password.i already make a new apple id..but my icloud use another account..so how to reset my iCloud account plz hel me

    hello i forgot my i cloud password..anyone can help me to find my password.i already make a new apple id..but my icloud use another account..so how to reset my iCloud account plz hel me

    Making a new Apple ID is not a good idea, since you have to reset the password for that Apple ID anyway. All of your purchases are tied to the Apple ID that the iCloud account was created under. So, you have to retrieve the password for that Apple ID in order to sign into iCloud anyway.
    Go to Manage your Apple ID, and click on the Reset Password option (Apple - My Apple ID). Sign on with the Apple ID that the iCloud account was created under, and answer the security questions. If you do not remember the answers to the Security Questions, contact Apple Support to have them reset:
    ACCOUNT SECURITY CONTACT NUMBERS
    Cheers,
    GB

  • Hello, can anyone tell me how to share my home macbook pro to my imac in the office? I tried file sharing but never worked for me...appreciate if anyone can help!

    Hello, can anyone tell me how to share my home macbook pro to my imac in the office? I tried file sharing but never worked for me...appreciate if anyone can help!

    I should have added to my posting (instead of using this "reply" -  it is the server passwork it is asking for and I have never known that I had one and assumed it was the passwork I always used for this type of thing.

  • HT201210 hi everyone, i have a problem about my iphone 4S, doesn't work with wifi connection and bluetooth since upgrade to the IOS 7.0.3. Can anyone can help me tosolve this problem?????Thank's regards paulus

    hi everyone, i have a problem about my iphone 4S, doesn't work with wifi connection and bluetooth since upgrade to the IOS 7.0.3. Can anyone can help me tosolve this problem?????Thank's regards paulus

    Try the suggestions here to see if they resolve your problem:
    http://support.apple.com/kb/ts1559
    If these don't work you may have a hardware problem. Visit an Apple store for an evaluation or contact Apple Support.

  • I can not save any data to external hard drive from my mac pro. Is there anyone can help me in this regard?( note, when i first plug my ext. drive to mac i chose option to backup later)

    I can not save any data to external hard drive from my mac pro. Is there anyone can help me in this regard?( note, when i first plug my ext. drive to mac i chose option to backup later)

    The device may be formatted for Windows, as NTFS. The format is readable, but not natively writable on a Mac. To write to the device, you must either reformat it (erasing all the contents) or install third-party software to enable write access to NTFS.

Maybe you are looking for

  • Old computer dead.  How do I sync my iPad's contents to a new computer?

    My computer died, and all the data with it. Have a new computer with iTunes. How do I get the iPad do dump all its data to the new computer's iTunes? Anyone?

  • Does Final Cut X recognize .m2t files?

    I am hesitant to upgrade to Final Cut X, the version of Final Cut Express I am using right now can not recognize .m2t files from a memory recording unit. Anybody knows if Final Cut X does??

  • XI Transport Process

    Hello Can anyone please help me with the detailed process for taking care of transports in IR & ID I am listing the steps based on the process we use which I know please correct me if I am wrong IR Tools-> Export Design Objects -> Select Source Softw

  • SAP ADHOC Query

    Hi, Please let me know how to export ADHOC query from one client to another client. Thanks Somashree

  • How to Restrict Subscriber from displaying his own Stream?

    How to pass opponent UserID to Subscriber ??? private function displayExistingStreams():void    {     var publishers:Object = _streamManager.getStreamsOfType(StreamManager.CAMERA_STREAM);     //status_txt.text += "displayExistingStreams";     for (va