Cryptography in networking,client can't get message from server but

Hello We are developing a simple Networking project where we are chaining CipherStreams to ObjectStream. When client gets connected to the server the server will send initial message to client and flush (but here is the problem) but the client does not get the message and is waiting for the message input.readObject() it just stuck there, what is the reason??
---Server Code----
server = new ServerSocket( 15000, 100 );
while ( true ) {
connection = server.accept();
connection.setTcpNoDelay(true);
// Get input and output streams.
desEn.init(Cipher.ENCRYPT_MODE, desKey);
//get the raw OutputStream
outraw = connection.getOutputStream();
//chain the OutputStream to the coutDES
CipherOutputStream
CipherOutputStream coutDES = new CipherOutputStream(outraw, desEn);
//chain the coutDES CipherOutputStream to
ObjectOutputStream of output
output = new ObjectOutputStream(coutDES);
String message = "SERVER>>>DES CONNECTION SUCCESSFUL!";
output.writeObject( message );
output.flush();
-End of Server Code--
-- Client code start-
Cipher desEn = Cipher.getInstance("DES"); //encrypting
Cipher Cipher desDe = Cipher.getInstance"DES");
client = new Socket(servername, 15000);
client.setTcpNoDelay(true);
desDe.init(Cipher.DECRYPT_MODE,desKey);
cinDES = new CipherInputStream(inraw, desDe);
input = new ObjectInputStream(cinDES);
// We got stuck here the program don't go beyond this line
Object obj = input.readObject();

Thank you for your suggestion. But I tried to chain the BufferedStream between ObjectStream and CipherStream. The problem still exit.
In the c/s sides, there are two functions to use the socket. One is the protocol part which does the handshaking before everything is prepared. Then a JTextField object is enabled and it will also use the socket and the chained stream to commnicate with the other part.
The concrete problem is strange, it seems there is some hidden buffer which holds the message. When a message is send and flush, it doesn't go to the net, instead it is hold somewhere until an other message is send and flush. So there are some delay. So in my code I have to use sendDate("\n") to push the useful message out into to net. And on the other side, eatBoundary() to get rid of the "\n" and then getMsg() to recieve the useful message.
However, for some time the communiction stuck, both sides are waiting. But when you send another message, the previous and the new message appear on the other side. In the way, it is hard to implement the handshaking which requires reliable syncronization. You have met the same problem before? If you think it is not clear enough could you send me your email addr and I can send you the source code.
my addr; [email protected]
Thanks again!
Best

Similar Messages

  • Got a new Samsung galaxy s3 and can't get messages from iphone users now. Don't have the old iphone to change the settings ! please help . need to know how I can get messages on my galaxy

    Can't get messages from iphone users on my new Samsung g allaxy and don't have my old iphone anymore ! Please help !

    Read here under no longer have device:
    http://support.apple.com/kb/ht5661
    Be aware, changing your Apple ID password doesn't always work, & can take up to 45 days to work.
    It's either that, or you call AppleCare & have them fix.

  • Lost my Iphone 4g, hooked up old 3gs, can't get messages from people who have me registered with ichat

    Anyone who I had previously used iChat with, can no longer send me texts now that I have had to downgrade back to a 3Gs.
    Lost my Iphone 4g, hooked up old 3gs, can't get messages from people who have me registered with ichat.
    My carrier (Rogers) says they have nothing they can do about it.
    Thanks in advance.

    Correction - iMessage, not iChat.  Too early....

  • How can I show message from server?

    Has anyone idea, how can I show message from server? I want to show message after some files are uploaded via FTP.

    Hi,
    You can use OPEN DATASET for this purpose.
    Try this code:
    <b>****************************************</b>
    Data:
    A_FILE TYPE RLGRAP-FILENAME,   "Application server
    P_FILE TYPE RLGRAP-FILENAME.   "Presentation server
    DATA: BEGIN OF ITAB OCCURS 0,
    LINE TYPE STRING,
    END OF ITAB.
    DATA: FILENAME TYPE STRING.
    FILENAME = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                = FILENAME
      TABLES
        DATA_TAB                = ITAB[]
      EXCEPTIONS
        FILE_OPEN_ERROR         = 1
        FILE_READ_ERROR         = 2
        NO_BATCH                = 3
        GUI_REFUSE_FILETRANSFER = 4
        INVALID_TYPE            = 5
        NO_AUTHORITY            = 6
        UNKNOWN_ERROR           = 7
        BAD_DATA_FORMAT         = 8
        HEADER_NOT_ALLOWED      = 9
        SEPARATOR_NOT_ALLOWED   = 10
        HEADER_TOO_LONG         = 11
        UNKNOWN_DP_ERROR        = 12
        ACCESS_DENIED           = 13
        DP_OUT_OF_MEMORY        = 14
        DISK_FULL               = 15
        DP_TIMEOUT              = 16
        OTHERS                  = 17.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    OPEN DATASET A_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP AT ITAB.
      TRANSFER ITAB-LINE TO A_FILE.
    ENDLOOP.
    <b>*****************************************</b>
    Hope this helps,
    Regards,
    Pragya

  • Can send I messages from ipad but reply only goes to Iphone

    Can send I messages from my I Pad but reply only comes to my Iphone

    Your question is a bit confusing, but your iPad can only send messages to other iOS devices, such as other iPad users, iPhone users and iPod touch users who have iMessage enabled on their devices.  You can not send text messages from iPad to non-Apple devices, like Android phones........

  • Can't get message from mailbox in shell script

    I'm using the shell-script workaround for the problem of creating messages from scripts run by a Mail rule. Can't seem to get the syntax right for getting a message passed from the main routine:
    Main
    <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:800px">using terms from application "Mail"
    on perform mail action with messages theMessages
    repeat with eachMessage in theMessages
    set theID to id of eachMessage
    set theBox to name of mailbox of eachMessage
    set theAccount to "none"
    try
    set theAccount to name of account of mailbox of eachMessage
    end try
    do shell script "osascript Users/dave/Library/Scripts/Applications/Mail/exp.scpt " & theID & " " & theBox & " " & theAccount
    end repeat
    end perform mail action with messages
    end using terms from
    using terms from application "Mail"
    on run
    tell application "Mail" to set sel to selection
    tell me to perform mail action with messages (sel)
    end run
    end using terms from</pre>
    Shell
    <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:800px">on run TheArgs
    using terms from application "Mail"
    set theID to item 1 of TheArgs
    set theBox to item 2 of TheArgs
    set theAccount to item 3 of TheArgs
    if theAccount = "none" then
    set theMessage to (message of mailbox theBox) whose id is (theID as integer)
    else
    set theMessage to (message of mailbox theBox of account theAccount) whose id is (theID as integer)
    end if</pre>
    The conditional is so I can test by selecting messages from either my Inbox or other boxes. Either way, though I get runtime errors like: "Can’t get «class mssg» of «class mbxp» \"INBOX\" of «class mact» \"David\" whose id of it = \"19111\". (-1728)"
    I've tried variations, but nothing seems to work.
    BTW, how does one view events or results in a shell script? Neither its window nor the main routine's show anything, and even "log" statements in the shell seem to go nowhere.

    I think I understand what's going wrong. If I select a message in my Inbox, the shell statement
    <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:800px">set theMessage to (message 1 of mailbox theBox of account theAccount) whose id is (theID as integer)</pre>
    works. If I select a message from an On My Mac box, though, I can't get theAccount in Main in the first place because there's no account associated with those boxes. That's why I set up the "try" in Main and the conditional in the shell. I see now that
    <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:800px">set theBox to name of mailbox of eachMessage</pre>
    in Main yields only the name of the box -- any containers it may have are omitted. Therefore,
    <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:800px">set theMessage to (message 1 of mailbox theBox) whose id is (theID as integer)</pre>
    fails if there are any containers. So, I need a "set theBox" statement in Main that produces a proper path to the message, regardless of where it's located. If I can formulate that, a single "set theMessage" in the shell will suffice, without having worry about whether there's an account. I've experimented with "path to" and will continue casting about, but if the solution is apparent to you, please let me know.
    BTW: Echo was a worthwhile "little diversion" for me, because it's led me to a better understanding of what "do shell script" does (i.e., it executes a UNIX command as if it was typed into Terminal) and why it solves the message-creation problem (i.e., it runs the named script as a process that's separate from Mail). I suppose that was obvious to you and many others, but it wasn't to me, despite reading what the AS Language Guide says about it, plus a few Google hits for "osascript." So thank you for that.
    One thing I don't understand, though: If I change the command to "echo $1 $2 $3", nothing appears in Terminal. (I can produce files the way you showed just fine.)

  • Can't get messages from my gmail account to my ipod touch to show up

    Hello,
    My daughter's ipod touch does not allow her to receive her email messages from her gmail account on the ipod touch. What do I need to do to have this work. It was working before I updated my iphone to icloud. At the time our accounts were linked since them I have seperated our accounts.
    SS

    This may help:
    iPhone, iPad, or iPod touch - Gmail Help

  • Can't get messages from iPhone user on my android

    I have recently swapped my iPhone for an android but still have I pad. I am not receiving messages from friends with I phones. Any ideas?

    Go to: https://supportprofile.apple.com/MySupportProfile.do
    Log in if not already logged in.
    Click on "Edit Products"
    Click on the "X" to the right of the product.
    Click "Unregister"

  • Can't get mails from server anymore !!

    Hi there,
    I am using Mail 2.1.3 with Tiger 10.4.11 on a G5 bi pro, and since a couple of days, e-mails from one of my POP accounts are not downloaded from the webmail server any longer... I can see them on the server, Mail 2.1.3 logs in successfully, but it seems that it simply doesn't download them...
    I have rebuild and re index all boxes already.
    I can send mails from that account with no problems, though and Mail 2.1.3 works fine with my others POP accounts.
    Can anybody help me on that issue ?
    Thank you very much.
    Mac OS X 10.4.11 (8S165)
    G5 Power PC 2 x 1.8 GHz

    I'm not aware of any limits. Before we do anything & to be safe...
    On Mail...
    First Quit Mail, then I'd backup these two Mail folders, by right clicking on them in the Finder, then choose Archive/Compress.
    Users/YourUserName/Library/Mail
    Users/YourUserName/Library/Mail Downloads
    (Could be a different folder here if you chose such in Mail Prefs)
    Right click on that Mail folder, choose archive, you'll get everything in the folder, and the folder itself in a file called Mail.zip, move it to a safe place, same for the Mail Downloads folder... only the plist is separate.
    /Users/YourUserName/Library/Preferences/com.apple.mail.plist
    Then, we can either trash the above file & setup Mail on running it again to exactly what we have now, or not trash it but in Mail Preferences>Accounts>Advanced... uncheck enable this account & uncheck Include when checking for new Mail.
    Then setup a new Account identical to the problem one with only some slight change to the Description that must be unique.

  • Can't remove messages from server

    Mail has randomly been failing to remove downloaded messages from the two independent servers that host our e-mail accounts. We've verified that all accounts have "remove copy.........: Right Away" selected in Advanced Preferences. Have gone so far as to deselect, close mail, and then open and reselect. Have also delected the MessageUidsAlreadyDownloaded2 file for each mailbox but the problem comes back after a few download cycles.
    We've also found one account where "Get Info" showed no messages on the server but logging in to that account using webmail showed 79 messages present.
    Must add that it deletes some messages and leaves others with no discernable pattern.
    We've repaired permissions, etc. but the problem persists.
    Any suggestions would be appreciated.
    Powerbook G4   Mac OS X (10.4.8)  

    Just when I thought the problem was solved - went all day yesterday without a hitch - this morning it left over 20 messages on the server immediately after the first "download" of the morning. Last night Mail was closed and the machine was in sleep mode. Opened mail and after it had completed the download went to the server and checked.
    So far there have been no reoccurrences. Will set up another machine to remove after moving from the Inbox and see what happens.
    Powerbook G4   Mac OS X (10.4.8)  

  • HT1923 Trying to remove ITunes so I can reinstall getting message from windows installer /feature that you are trying to use is on a network resource that is unavailable? How do I correct same message when trying to install upgrade.

    Message receiving is from windows installer:the feature you are trying to use is on a network resource that is unavailable

    Many thanks.
    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any Apple Software Update entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install using an iTunesSetup.exe (or iTunes64Setup.exe) downloaded from the Apple Website:
    http://www.apple.com/itunes/download/
    Does it go through properly this time?

  • Can't get messages from icloud

    I have me.com account and it was working fine, I tried to send and email with a big file attached but it could not send it. After that I delete the message and tried to send a new mail but it is working as it is reading mail but it doesn't do anything and I can't read my mail on my mac. I have Lion 10.7.3

    troubleshooting imessage http://support.apple.com/kb/ts2755
    about message http://support.apple.com/kb/HT3529

  • Can't get messages from certain contacts

    Can't send or receive messages to some of my contacts

    Hi there Dunlop14,
    You may find the troubleshooting steps in the article below helpful.
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    -Griff W. 

  • How do how do I get imessages off I have a galaxy now and I need imessages off or I can't get messages from iphone user'sget imessages off I have a galaxy now and I need imessages off or I can't get messages from iphone user's

    Plz help

    Go to: https://supportprofile.apple.com/MySupportProfile.do
    Log in if not already logged in.
    Click on "Edit Products"
    Click on the "X" to the right of the product.
    Click "Unregister"

  • Can receive BB messages from but can't send them to a contact

    For months I have been sending and receiving messages to a contact. As of two days ago, I can receive BB messages from him, but when I send him a message I can the tick, but the message is never delivered (no 'D' or 'R').
    I have changed no settings on my Bold 9900. We are both on the same carrier.
    Please can someone help. Have come across loads of posts detailing the same problem, but not yet found an answer.
    Thanks

    It sounds like an issue on the recipient's side, not yours.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

Maybe you are looking for

  • Mouse Clicks' Queue when Button is Disabled

    Hi, I was wondering about the Disable property for UI Components. In the docs it says that when the component is disabled it ignores all interaction whatsoever - in particular - user interaction. In my case, the button is disabled for a few seconds r

  • How to get pics from phone

    the camera on this phone is totally useless. Can't get pictures off. Tells me to use icloud and photostream. B\ut icloud doesn't have any place for pics. Documentation is vwery poor. Wants to use terms like istream, icloud with no explanation what th

  • Sales report period wise

    Hi Is there any report in SAP to know the customer wise Sales Organisation wise sales order peport. we need to konw customer wise sales orders report period wise. how many salea orders we booked for the customer wise. EX: Customer No | Customer Name|

  • How do i sync all my bookmarks to all my other pcs without deleted anything

    some PC have bookmarks already and i don't want to delete them. i just want to add more to them. some PC have a lot some have a little

  • Authorizing my computer

    i have just recently bought a new pc and itunes wont let me sync any music onto my ipod unless i authorize my computer (which i have) and it still doesnt work.