Stop and wait

I am a new student in Java programming, and we haven't studied java networking yet, but I'm taking another couse called Data and Computer Communications which require us to write two programs in Java that will communicate with each other, it's meant to make me experience networking and it's not a java test, but in order to do that I have to have those programs. I appreciate the help:
Stop-And-Wait
I need to write two programs, a Sender and a Receiver, communicate with UDP. The Sender gets a text string from the keyboard (user input). The communication canal can only handle a packet of 10 bytes (we simulate this by not sending a packet of more than 10 bytes). In other words, the Sender must break down the messages into small chunks and sends them one at a time. Each packet will also have 3 bytes of control information, which means that the data size in each packet can not exceed 7.
The message format of each packet is:
| seq | cntrl | data | check |
where seq(1 byte) is a sequence number, data (<=7 bytes), check (1 byte),
cntrl includes
| type | flag | len |
where type(1 bit) =0 for data packet, 1 for ACK/NAK;
flag(1 bit) = 1 for the last packet in the message, 0 if the packet is not the last one.
flag(1 bit) = 0 for ACK, 1 for NAK (for a receipt packet).
len(6 bits) = data length (number of bytes) for data packet; 0 for a receipt packet.
In each message, the sequence number (seq) for the first packet = 0.
When a packet is created, all the fields will be filled except for check.
The checksum is created by adding the remaining bytes (<=9) modulo-256, and this is filled in the check field.
We simulate the transfer error by creating an instance of the class Error (I will e-mail it, if you send me your e-mail address).
A suitable number for the error frequency, is 5 to 10 (i.e. 0.5 to 1 % error chance per bit). Each bit is to filtered by Error ( buf = error.error(buf); ).
When the Receiver gets a packet, it checks the checksum and if it is correct, it sends an ACK, otherwise it sends a NAK. Notice that even those need to be filtered through Error, which means that they are also open for transfer error.
When the Sender gets an ACK or a NAK, it checks the checksum. If the checksum is correct for an ACK, it sends the next packet if there are more packets to send. If the checksum is correct for a NAK or it is incorrect (for both), the Sender sends the last sent packet again. Note that even then a sequence number is required.
A number of error situations must be dealt with: when a data packet is corrupted, when an ACK is corrupted, or when a NAK is corrupted. Men we know that the packet always is delivered.
When the last packet is received, the Receiver write a message on the screen, resets itself, and waits again.
You can reply directly to my e-mail at: [email protected]
Thanx

Start by reading the "Custom Networking" tutorial found on this page:
http://java.sun.com/docs/books/tutorial/

Similar Messages

  • Some videos stop and go whats going on?

    I have owned an iphone for a couple of weeks. It seems that often (or maybe always) when playing a video from apps and youtube, the video keeps stopping. If you keep pressing the play button, the video may play for a couple of seconds but then stops. This happens with my daughters iphone bought at the same time. What is happening?
    Please Help ASAP...

    What's happening is the video is playing faster than it can be downloaded, so it stops often. The trick is to let your iPhone decide on when to start playing the video... it will start the video automatically when it determines that you can watch the entire video without stopping and waiting for the download to catchup.

  • Making stop and play functions fool-proof

    I have a timeline control embedded into my flash piece. It
    contains the buttons "Re-Play, Pause, and Play." I am building some
    testing software, therefore I have instances where the
    animation/sound stops and waits for the user to select an answer.
    At first, I had a problem that, when the user would come to a
    stop point, they could simply click the play button and the audio
    would continue (the play button simply held a command like this):
    on (press) {
    play();
    So I changed it to an IF statement that looked for a variable
    before the PLAY button could be pressed. It looks like this:
    MP3Player, Frame 1
    set ("operator",1);
    Play Button
    on (press) {
    if (operator==1) {
    if (operator==2) {
    play();
    set ("operator",1);
    Pause Button
    on (press) {
    stop();
    set ("operator",2);
    It shows that, in order for Play to work, the user must first
    PAUSE the flash piece.
    The problem therein is that if the user comes to a stop in
    the timeline, they can simply click PAUSE and then PLAY and
    continue on the MP3Player element without advancing any of the
    animation. Is there anyone who can help me fix this? Thanks!

    Sorry - yeah you're right i didn't think that through
    completely. Use the code I suggested though, and add more code
    elsewhere. at the moment operator has two states, yeah? 1=playing,
    2=paused. You could introduce a third state - 3=quiz(or whatever's
    going on in your application).
    So wherever you have your stop() action on a frame, add the
    line:
    operator=3;
    and where the user selects their answer(i am assuming the
    animation continues on at this point?) and you have a play()
    action, add the line:
    operator=1;
    this should give you what you're asking for. the fleece does
    have a point though, that it would make sense to remove the
    play/pause buttons altogether during the quiz as they are inactive
    anyway.
    Craig

  • Can iTunes be set to stop at the end of a track and wait for a manual play.

    I am wanting to use itunes to play sound effects in a live drama but I need to have it stop at the end of each track and wait for a manual start. It needs to be done without deselecting and selecting tracks by myself and, importantly, others who may be confused by the computer.
    If iTunes can't do this is there any other app that can, I've been looking but failed to find any apart from DJ packages which are more complicated than I would like for others to use.
    Dave

    You want to have a bunch of tracks, play them in order, the first one plays then it stops and all you have to do is hit Play to continue to next track?
    This script will do it.
    Play the first track and iTunes will stop at the end and queue up the next song. Just press Play (or Spacebar) and it'll  play the second song and stop till the end of the playlist.
    No need to select any songs or do anything fancy.
    -> Stop Track!
    "This script applet runs in the background while an iTunes playlist is playing. Whenever the accompanying "STOP_TRACK_05sec.mp3" track is encountered, the script will stop iTunes and advance to the next track, which you can start manually."

  • HT1725 I was downloading a game on my iPad and then it stop and kept saying waiting when I click it nothing happens and I try to delete it and it won't what should I do

    I was downloading a game on my iPad and then it stop and kept saying waiting when I click it nothing happens and I try to delete it and it won't what should I do

    If you tap and hold down the icon - and the X does not appear on the icon - you will not be able to delete it without totally downloading it. Finish the download and then delete it.

  • I can't download LIon OS.  It's just stopped and says "waiting."

    I was downloading OS X Lion and it started up after clicking the pause button a few times.  Then it stopped and said "Waiting."  I restarted my computer and clicked on purchase in the App Store and got the above messayge.  I don't believe that a download should take 16 days.  I have been clicking on the pause button but it doesn't change anything. It keeps the 16 days or gives me "Waiting" as shown below.
    I am so frustrated.  What should I do?

    Try this
    First disconnect your WiFi and if your downloads fails, so that you can remove it and download again from purchased history.
    If it doesn't work, go to application folder try locating lion.app and delete it completely out of system and try downloading again.

  • Force wait activity to stop and continue flow

    Dear,
    Is it possible to force an active wait activity (that is scheduled to expire a couple of hours later) to stop and to continue the flow with the next activity?
    Thanks in advance for your feedback,
    Veerle Antonissen

    How would you like to force the wait activity prematurely? AFAIK this is only possible with by setting an alarm on a reveive activity, i.e. waiting for a maximum time (comparable to wait) and at the same time waiting for a message (receive activity), whatever happens first. If you send a message to the receive, it will continue before the alarm times out.
    Does this solve your problem?

  • HT3209 why does my movie rental download stop and reload just before it completes the download. I've tried 4 times now after waiting hours for the download. Ugh!

    why does my movie rental download stop and reload just before it completes the download. I've tried 4 times now after waiting hours for the download. Ugh!

    This Apple article might help ya out -> iTunes Store: "Error (-50)" when downloading purchased content
    Try following along with the article and deleting the cached downloads, then try again.

  • Dispatcher stopped and Workprocessors are Ended State

    Hi Experts
    Suddenly my dispatcher stopped and all work processors are in Ended state in the ECC6.0 with Oracle database in windows 2003.  I have checked the Memory parameters and resetted the values but still getting the same problem here i am pasting the dev_disp and dev_w0 files.  Please help me need full
    Regards
    Chandra
    dev_disp::
    trc file: "dev_disp", trc level: 1, release: "700"
    sysno      00
    sid        CHE
    systemid   560 (PC with Windows NT)
    relno      7000
    patchlevel 0
    patchno    175
    intno      20050900
    make:      multithreaded, Unicode, optimized
    pid        1536
    Sun Dec 07 13:05:43 2008
    kernel runs with dp version 241000(ext=110000) (@(#) DPLIB-INT-VERSION-241000-UC)
    length of sys_adm_ext is 576 bytes
    SWITCH TRC-HIDE on ***
    ***LOG Q00=> DpSapEnvInit, DPStart (00 1536) [dpxxdisp.c   1261]
         shared lib "dw_xml.dll" version 175 successfully loaded
         shared lib "dw_xtc.dll" version 175 successfully loaded
         shared lib "dw_stl.dll" version 175 successfully loaded
         shared lib "dw_gui.dll" version 175 successfully loaded
         shared lib "dw_mdm.dll" version 175 successfully loaded
    rdisp/softcancel_sequence :  -> 0,5,-1
    use internal message server connection to port 3900
    Sun Dec 07 13:05:54 2008
    WARNING => DpNetCheck: NiHostToAddr(www.doesnotexist0081.qqq.nxst) took 11 seconds
    Sun Dec 07 13:05:59 2008
    WARNING => DpNetCheck: NiAddrToHost(1.0.0.0) took 5 seconds
    ***LOG GZZ=> 2 possible network problems detected - check tracefile and adjust the DNS settings [dpxxtool2.c  5418]
    MtxInit: 30000 0 0
    DpSysAdmExtInit: ABAP is active
    DpSysAdmExtInit: VMC (JAVA VM in WP) is not active
    DpIPCInit2: start server >I3LSERVSAP1_CHE_00                      <
    DpShMCreate: sizeof(wp_adm)          23856     (1704)
    DpShMCreate: sizeof(tm_adm)          4415616     (21968)
    DpShMCreate: sizeof(wp_ca_adm)          24064     (80)
    DpShMCreate: sizeof(appc_ca_adm)     8000     (80)
    DpCommTableSize: max/headSize/ftSize/tableSize=500/8/528056/528064
    DpShMCreate: sizeof(comm_adm)          528064     (1048)
    DpSlockTableSize: max/headSize/ftSize/fiSize/tableSize=0/0/0/0/0
    DpShMCreate: sizeof(slock_adm)          0     (96)
    DpFileTableSize: max/headSize/ftSize/tableSize=0/0/0/0
    DpShMCreate: sizeof(file_adm)          0     (72)
    DpShMCreate: sizeof(vmc_adm)          0     (1544)
    DpShMCreate: sizeof(wall_adm)          (38456/34360/64/184)
    DpShMCreate: sizeof(gw_adm)     48
    DpShMCreate: SHM_DP_ADM_KEY          (addr: 06840040, size: 5081056)
    DpShMCreate: allocated sys_adm at 06840040
    DpShMCreate: allocated wp_adm at 06842118
    DpShMCreate: allocated tm_adm_list at 06847E48
    DpShMCreate: allocated tm_adm at 06847E78
    DpShMCreate: allocated wp_ca_adm at 06C7DEF8
    DpShMCreate: allocated appc_ca_adm at 06C83CF8
    DpShMCreate: allocated comm_adm at 06C85C38
    DpShMCreate: system runs without slock table
    DpShMCreate: system runs without file table
    DpShMCreate: allocated vmc_adm_list at 06D06AF8
    DpShMCreate: allocated gw_adm at 06D06B38
    DpShMCreate: system runs without vmc_adm
    DpShMCreate: allocated ca_info at 06D06B68
    DpShMCreate: allocated wall_adm at 06D06B70
    MBUF state OFF
    DpCommInitTable: init table for 500 entries
    rdisp/queue_size_check_value :  -> off
    ThTaskStatus: rdisp/reset_online_during_debug 0
    EmInit: MmSetImplementation( 2 ).
    MM global diagnostic options set: 0
    <ES> client 0 initializing ....
    <ES> InitFreeList
    <ES> block size is 1024 kByte.
    Using implementation view
    <EsNT> Using memory model view.
    <EsNT> Memory Reset disabled as NT default
    <ES> 4075 blocks reserved for free list.
    ES initialized.
    rdisp/http_min_wait_dia_wp : 1 -> 1
    ***LOG CPS=> DpLoopInit, ICU ( 3.0 3.0 4.0.1) [dpxxdisp.c   1668]
    ***LOG Q0K=> DpMsAttach, mscon ( I3LSERVSAP1) [dpxxdisp.c   12364]
    DpStartStopMsg: send start message (myname is >I3LSERVSAP1_CHE_00                      <)
    DpStartStopMsg: start msg sent
    CCMS: AlInitGlobals : alert/use_sema_lock = TRUE.
    CCMS: Initalizing shared memory of size 60000000 for monitoring segment.
    CCMS: Checking Downtime Configuration of Monitoring Segment.
    CCMS: start to initalize 3.X shared alert area (first segment).
    DpMsgAdmin: Set release to 7000, patchlevel 0
    MBUF state PREPARED
    MBUF component UP
    DpMBufHwIdSet: set Hardware-ID
    ***LOG Q1C=> DpMBufHwIdSet [dpxxmbuf.c   1050]
    DpMsgAdmin: Set patchno for this platform to 175
    Release check o.K.
    Sun Dec 07 13:06:39 2008
    my types changed after wp death/restart 0xbf --> 0xbe
    my types changed after wp death/restart 0xbe --> 0xbc
    my types changed after wp death/restart 0xbc --> 0xb8
    my types changed after wp death/restart 0xb8 --> 0xb0
    my types changed after wp death/restart 0xb0 --> 0xa0
    my types changed after wp death/restart 0xa0 --> 0x80
    DP_FATAL_ERROR => DpWPCheck: no more work processes
    DISPATCHER EMERGENCY SHUTDOWN ***
    increase tracelevel of WPs
    NiWait: sleep (10000ms) ...
    NiISelect: timeout 10000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:49 2008
    NiISelect: TIMEOUT occured (10000ms)
    dump system status
    Workprocess Table (long)               Sun Dec 07 07:36:49 2008
    ========================
    No Ty. Pid      Status  Cause Start Err Sem CPU    Time  Program          Cl  User         Action                    Table
    0 DIA     6120 Ended         no      1   0        0                                                                         
    1 DIA     2860 Ended         no      1   0        0                                                                         
    2 DIA     6020 Ended         no      1   0        0                                                                         
    3 DIA     5632 Ended         no      1   0        0                                                                         
    4 DIA      588 Ended         no      1   0        0                                                                         
    5 DIA     6016 Ended         no      1   0        0                                                                         
    6 UPD      484 Ended         no      1   0        0                                                                         
    7 ENQ     2268 Ended         no      1   0        0                                                                         
    8 BTC      584 Ended         no      1   0        0                                                                         
    9 BTC     6064 Ended         no      1   0        0                                                                         
    10 BTC     4228 Ended         no      1   0        0                                                                         
    11 BTC     5980 Ended         no      1   0        0                                                                         
    12 SPO     1984 Ended         no      1   0        0                                                                         
    13 UP2     5996 Ended         no      1   0        0                                                                         
    Dispatcher Queue Statistics               Sun Dec 07 07:36:49 2008
    ===========================
    --------++++--
    +
    Typ
    now
    high
    max
    writes
    reads
    --------++++--
    +
    NOWP
    0
    2
    2000
    6
    6
    --------++++--
    +
    DIA
    5
    5
    2000
    5
    0
    --------++++--
    +
    UPD
    0
    0
    2000
    0
    0
    --------++++--
    +
    ENQ
    0
    0
    2000
    0
    0
    --------++++--
    +
    BTC
    0
    0
    2000
    0
    0
    --------++++--
    +
    SPO
    0
    0
    2000
    0
    0
    --------++++--
    +
    UP2
    0
    0
    2000
    0
    0
    --------++++--
    +
    max_rq_id          12
    wake_evt_udp_now     0
    wake events           total     8,  udp     7 ( 87%),  shm     1 ( 12%)
    since last update     total     8,  udp     7 ( 87%),  shm     1 ( 12%)
    Dump of tm_adm structure:               Sun Dec 07 07:36:49 2008
    =========================
    Term    uid  man user    term   lastop  mod wp  ta   a/i (modes)
    Workprocess Comm. Area Blocks               Sun Dec 07 07:36:49 2008
    =============================
    Slots: 300, Used: 1, Max: 0
    --------++--
    +
    id
    owner
    pid
    eyecatcher
    --------++--
    +
    0
    DISPATCHER
    -1
    WPCAAD000
    NiWait: sleep (5000ms) ...
    NiISelect: timeout 5000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:54 2008
    NiISelect: TIMEOUT occured (5000ms)
    DpHalt: shutdown server >I3LSERVSAP1_CHE_00                      < (normal)
    DpJ2eeDisableRestart
    DpModState: buffer in state MBUF_PREPARED
    NiBufSend starting
    NiIWrite: hdl 2 sent data (wrt=110,pac=1,MESG_IO)
    MsINiWrite: sent 110 bytes
    MsIModState: change state to SHUTDOWN
    DpModState: change server state from STARTING to SHUTDOWN
    Switch off Shared memory profiling
    ShmProtect( 57, 3 )
    ShmProtect(SHM_PROFILE, SHM_PROT_RW
    ShmProtect( 57, 1 )
    ShmProtect(SHM_PROFILE, SHM_PROT_RD
    DpWakeUpWps: wake up all wp's
    Stop work processes
    Stop gateway
    killing process (6084) (SOFT_KILL)
    Stop icman
    killing process (6128) (SOFT_KILL)
    Terminate gui connections
    wait for end of work processes
    wait for end of gateway
    [DpProcDied] Process lives  (PID:6084  HANDLE:1484)
    waiting for termination of gateway ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:55 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process died  (PID:6084  HANDLE:1484)
    wait for end of icman
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:56 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:57 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:58 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:06:59 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:00 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:01 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:02 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:03 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:04 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:05 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process lives  (PID:6128  HANDLE:1488)
    waiting for termination of icman ...
    NiWait: sleep (1000ms) ...
    NiISelect: timeout 1000ms
    NiISelect: maximum fd=1513
    NiISelect: read-mask is NULL
    NiISelect: write-mask is NULL
    Sun Dec 07 13:07:06 2008
    NiISelect: TIMEOUT occured (1000ms)
    [DpProcDied] Process died  (PID:6128  HANDLE:1488)
    DpStartStopMsg: send stop message (myname is >I3LSERVSAP1_CHE_00                      <)
    NiIMyHostName: hostname = 'I3LSERVSAP1'
    AdGetSelfIdentRecord: >                                                                           <
    AdCvtRecToExt: opcode 60 (AD_SELFIDENT), ser 0, ex 0, errno 0
    AdCvtRecToExt: opcode 4 (AD_STARTSTOP), ser 0, ex 0, errno 0
    DpConvertRequest: net size = 189 bytes
    NiBufSend starting
    NiIWrite: hdl 2 sent data (wrt=562,pac=1,MESG_IO)
    MsINiWrite: sent 562 bytes
    send msg (len 110+452) to name                    -, type 4, key -
    DpStartStopMsg: stop msg sent
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 received data (rcd=274,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=274
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 274 bytes
    MSG received, len 110+164, flag 1, from MSG_SERVER          , typ 0, key -
    DpHalt: received 164 bytes from message server
    NiIRead: hdl 2 recv would block (errno=EAGAIN)
    NiIRead: read for hdl 2 timed out (0ms)
    DpHalt: no more messages from the message server
    DpHalt: send keepalive to synchronize with the message server
    NiBufSend starting
    NiIWrite: hdl 2 sent data (wrt=114,pac=1,MESG_IO)
    MsINiWrite: sent 114 bytes
    send msg (len 110+4) to name           MSG_SERVER, type 0, key -
    MsSndName: MS_NOOP ok
    Send 4 bytes to MSG_SERVER
    NiIRead: hdl 2 recv would block (errno=EAGAIN)
    NiIPeek: peek successful for hdl 2 (r)
    NiIRead: hdl 2 received data (rcd=114,pac=1,MESG_IO)
    NiBufIIn: NIBUF len=114
    NiBufIIn: packet complete for hdl 2
    NiBufReceive starting
    MsINiRead: received 114 bytes
    MSG received, len 110+4, flag 3, from MSG_SERVER          , typ 0, key -
    Received 4 bytes from MSG_SERVER                             
    Received opcode MS_NOOP from msg_server, reply MSOP_OK
    MsOpReceive: ok
    MsSendKeepalive : keepalive sent to message server
    NiIRead: hdl 2 recv would block (errno=EAGAIN)
    Sun Dec 07 13:07:07 2008
    NiIPeek: peek for hdl 2 timed out (r; 1000ms)
    NiIRead: read for hdl 2 timed out (1000ms)
    DpHalt: no more messages from the message server
    DpHalt: sync with message server o.k.
    detach from message server
    ***LOG Q0M=> DpMsDetach, ms_detach () [dpxxdisp.c   12710]
    NiBufSend starting
    NiIWrite: hdl 2 sent data (wrt=110,pac=1,MESG_IO)
    MsINiWrite: sent 110 bytes
    MsIDetach: send logout to msg_server
    MsIDetach: call exit function
    DpMsShutdownHook called
    NiBufISelUpdate: new MODE -- (r-) for hdl 2 in set0
    SiSelNSet: set events of sock 1420 to: ---
    NiBufISelRemove: remove hdl 2 from set0
    SiSelNRemove: removed sock 1420 (pos=2)
    SiSelNRemove: removed sock 1420
    NiSelIRemove: removed hdl 2
    MBUF state OFF
    AdGetSelfIdentRecord: >                                                                           <
    AdCvtRecToExt: opcode 60 (AD_SELFIDENT), ser 0, ex 0, errno 0
    AdCvtRecToExt: opcode 40 (AD_MSBUF), ser 0, ex 0, errno 0
    AdCvtRecToExt: opcode 40 (AD_MSBUF), ser 0, ex 0, errno 0
    blks_in_queue/wp_ca_blk_no/wp_max_no = 1/300/14
    LOCK WP ca_blk 1
    make DISP owner of wp_ca_blk 1
    DpRqPutIntoQueue: put request into queue (reqtype 1, prio LOW, rq_id 15)
    MBUF component DOWN
    NiICloseHandle: shutdown and close hdl 2 / sock 1420
    NiBufIClose: clear extension for hdl 2
    MsIDetach: detach MS-system
    cleanup EM
    EsCleanup ....
    EmCleanup() -> 0
    Es2Cleanup: Cleanup ES2
    ***LOG Q05=> DpHalt, DPStop ( 1536) [dpxxdisp.c   10908]
    Good Bye .....
    dev_w0::
    trc file: "dev_w0", trc level: 1, release: "700"
    ACTIVE TRACE LEVEL           1
    ACTIVE TRACE COMPONENTS      all, MJ

    B Sun Dec 07 13:05:59 2008
    B  create_con (con_name=R/3)
    B  Loading DB library 'F:\usr\sap\CHE\DVEBMGS00\exe\dboraslib.dll' ...
    B  Library 'F:\usr\sap\CHE\DVEBMGS00\exe\dboraslib.dll' loaded
    B  Version of 'F:\usr\sap\CHE\DVEBMGS00\exe\dboraslib.dll' is "700.08", patchlevel (0.167)
    B  New connection 0 created
    M sysno      00
    M sid        CHE
    M systemid   560 (PC with Windows NT)
    M relno      7000
    M patchlevel 0
    M patchno    175
    M intno      20050900
    M make:      multithreaded, Unicode, optimized
    M pid        6120
    M
    M  kernel runs with dp version 241000(ext=110000) (@(#) DPLIB-INT-VERSION-241000-UC)
    M  length of sys_adm_ext is 576 bytes
    M  ***LOG Q0Q=> tskh_init, WPStart (Workproc 0 6120) [dpxxdisp.c   1323]
    I  MtxInit: 30000 0 0
    M  DpSysAdmExtCreate: ABAP is active
    M  DpSysAdmExtCreate: VMC (JAVA VM in WP) is not active
    M  DpShMCreate: sizeof(wp_adm)          23856     (1704)
    M  DpShMCreate: sizeof(tm_adm)          4415616     (21968)
    M  DpShMCreate: sizeof(wp_ca_adm)          24064     (80)
    M  DpShMCreate: sizeof(appc_ca_adm)     8000     (80)
    M  DpCommTableSize: max/headSize/ftSize/tableSize=500/8/528056/528064
    M  DpShMCreate: sizeof(comm_adm)          528064     (1048)
    M  DpSlockTableSize: max/headSize/ftSize/fiSize/tableSize=0/0/0/0/0
    M  DpShMCreate: sizeof(slock_adm)          0     (96)
    M  DpFileTableSize: max/headSize/ftSize/tableSize=0/0/0/0
    M  DpShMCreate: sizeof(file_adm)          0     (72)
    M  DpShMCreate: sizeof(vmc_adm)          0     (1544)
    M  DpShMCreate: sizeof(wall_adm)          (38456/34360/64/184)
    M  DpShMCreate: sizeof(gw_adm)     48
    M  DpShMCreate: SHM_DP_ADM_KEY          (addr: 06840040, size: 5081056)
    M  DpShMCreate: allocated sys_adm at 06840040
    M  DpShMCreate: allocated wp_adm at 06842118
    M  DpShMCreate: allocated tm_adm_list at 06847E48
    M  DpShMCreate: allocated tm_adm at 06847E78
    M  DpShMCreate: allocated wp_ca_adm at 06C7DEF8
    M  DpShMCreate: allocated appc_ca_adm at 06C83CF8
    M  DpShMCreate: allocated comm_adm at 06C85C38
    M  DpShMCreate: system runs without slock table
    M  DpShMCreate: system runs without file table
    M  DpShMCreate: allocated vmc_adm_list at 06D06AF8
    M  DpShMCreate: allocated gw_adm at 06D06B38
    M  DpShMCreate: system runs without vmc_adm
    M  DpShMCreate: allocated ca_info at 06D06B68
    M  DpShMCreate: allocated wall_adm at 06D06B70
    M  rdisp/queue_size_check_value :  -> off
    M  ThTaskStatus: rdisp/reset_online_during_debug 0
    X  EmInit: MmSetImplementation( 2 ).
    X  MM global diagnostic options set: 0
    X  <ES> client 0 initializing ....
    X  Using implementation view
    X  <EsNT> Using memory model view.
    M  <EsNT> Memory Reset disabled as NT default
    X  ES initialized.

    M Sun Dec 07 13:06:00 2008
    M  ThInit: running on host I3LSERVSAP1

    M Sun Dec 07 13:06:01 2008
    M  calling db_connect ...
    C  Prepending F:\usr\sap\CHE\DVEBMGS00\exe to Path.
    C  Oracle Client Version: '10.2.0.1.0'
    C  Client NLS settings: AMERICAN_AMERICA.UTF8
    C  Logon as OPS$-user to get SAPSR3's password
    C  Connecting as /@CHE on connection 0 (nls_hdl 0) ... (dbsl 700 030508)
    C  Nls CharacterSet                 NationalCharSet              C      EnvHp      ErrHp ErrHpBatch
    C    0 UTF8                                                      1   0672A1A8   0672F744   0672EFCC
    C  Attaching to DB Server CHE (con_hdl=0,svchp=0672EF18,srvhp=06740B04)
    C  Starting user session (con_hdl=0,svchp=0672EF18,srvhp=06740B04,usrhp=06755878)
    C  Now '/@CHE' is connected: con_hdl=0, nls_hdl=0, session_id=85.
    C  Got SAPSR3's password from OPS$-user
    C  Disconnecting from connection 0 ...
    C  Closing user session (con_hdl=0,svchp=0672EF18,usrhp=06755878)
    C  Now I'm disconnected from ORACLE
    C  Connecting as SAPSR3/<pwd>@CHE on connection 0 (nls_hdl 0) ... (dbsl 700 030508)
    C  Nls CharacterSet                 NationalCharSet              C      EnvHp      ErrHp ErrHpBatch
    C    0 UTF8                                                      1   0672A1A8   0672F744   0672EFCC
    C  Starting user session (con_hdl=0,svchp=0672EF18,srvhp=06740B04,usrhp=06755878)
    C  Now 'SAPSR3/<pwd>@CHE' is connected: con_hdl=0, nls_hdl=0, session_id=85.
    C  Database NLS settings: AMERICAN_AMERICA.UTF8
    C  DB instance CHE is running on I3LSERVSAP1 with ORACLE version 10.2.0.2.0 since DEC 07, 2008, 12:36:31
    B  Connection 0 opened (DBSL handle 0)
    B  Wp  Hdl ConName          ConId     ConState     TX  PRM RCT TIM MAX OPT Date     Time   DBHost         
    B  000 000 R/3              000000000 ACTIVE       NO  YES NO  000 255 255 20081207 130601 I3LSERVSAP1    
    C  build_stmt: reallocating stmt buffer: 256 -> 2000 characters
    M  db_connect o.k.
    M  ICT: exclude compression: .zip,.cs,.rar,.arj,.z,.gz,.tar,.lzh,.cab,.hqx,.ace,.jar,.ear,.war,.css,.pdf,.js,.gzip,.uue,.bz2,.iso,.sda,.sar,.gif
    I  MtxInit: 0 0 0
    M  SHM_PRES_BUF               (addr: 0B3A0040, size: 4400000)
    I  *** ERROR => [MapOsShm] Can't find free space for Shared Memory (Size=720000 KB)
                   [shmnt.c      2174]
    I  *** ERROR => [CreateOsShm] MapViewOfFile(Key=9,Handle=0x000004DC) failed with Err=0
                   [shmnt.c      2174]
    I  *** ERROR => ShmCreate: Create (9,737280000,3) failed [shmnt.c      506]
    Memory diagnostic                                 *
    Systeminformation
    Processor-Typ             : Intel Pentium Pro
    Processor-Count           : 8
    Operating System          : NT 5.2, Build 3790
    Service Pack              : Service Pack 2
    NT Pagefile Informations
    Config. minimum size      : 12570624 K
    Config. maximum size      : 12570624 K
    Avail.  maximum size      : 12570624 K
    Num
    Pagefile
    Min.Size
    Max.Size
    Avail.Max
    Curr.Size
    1
    c:\pagefile.sys
    4190208 K
    4190208 K
    4190208 K
    4190208 K
    2
    d:\pagefile.sys
    4190208 K
    4190208 K
    4190208 K
    4190208 K
    3
    f:\pagefile.sys
    4190208 K
    4190208 K
    4190208 K
    4190208 K
    NT Task Manager Informations
    Total Handles             :        0
    Total Threads             :        0
    Total Processes           :        0
    Commit Charge Total       :  6571584 K
    Commit Charge Limit       : 15822776 K
    Commit Charge Peak        :  7495116 K
    Phys.Memory Total         :       54 K
    Phys.Memory Available     : 93650276 K
    File Cache                : 17399116 K
    Kernel Memory Total       : 2084222616 K
    Kernel Memory Paged       :        0 K
    Kernel Memory Nonpaged    : 93650304 K
    Memory usage of current process
    Total virt.address space  :  2097024 K
    Avail.virt.address space  :   837328 K
    Private Pages             :        0 K
    Total heap size           :    14532 K
    Virtual memory regions    :        0 K
    Uncommitted heap memory   :     6440 K
    Allocated heap memory     :     6850 K
    Moveable heap memory      :        0 K
    DDE shared heap memory    :        0 K
    Memory usage of all processes
    PID
    Image
    Instance
    Work.Set
    WS Peak
    Priv.Pages
    PP Peak
    Pg Fault
    1940
    sapstartsrv.exe
    15956 K
    15956 K
    18656 K
    18700 K
    4
    5716
    msg_server.EXE
    [MS] CHE_00
    8508 K
    8508 K
    11000 K
    11000 K
    2
    1536
    disp+work.EXE
    [DP] CHE_00
    93256 K
    93256 K
    69540 K
    69540 K
    22
    5772
    igswd.EXE
    [**] CHE_00
    2796 K
    3048 K
    1436 K
    1724 K
    0
    1304
    igsmux.exe
    12012 K
    12012 K
    13032 K
    13032 K
    2
    5696
    igspw.exe
    2536 K
    2536 K
    2336 K
    2336 K
    0
    5688
    igspw.exe
    2536 K
    2536 K
    2336 K
    2336 K
    0
    6084
    gwrd.EXE
    [GW] CHE_00
    10164 K
    10164 K
    9996 K
    17924 K
    2
    6128
    icman.EXE
    [**] CHE_00
    86128 K
    86128 K
    88096 K
    88096 K
    21
    6120
    disp+work.EXE
    31808 K
    31904 K
    82200 K
    85356 K
    7
    2860
    disp+work.EXE
    [WP] CHE_00
    30604 K
    30604 K
    81656 K
    85356 K
    7
    6020
    disp+work.EXE
    [WP] CHE_00
    16080 K
    16080 K
    67372 K
    67372 K
    3
    5632
    disp+work.EXE
    [WP] CHE_00
    16104 K
    16104 K
    67372 K
    67372 K
    3
    588
    disp+work.EXE
    [WP] CHE_00
    28804 K
    28804 K
    80672 K
    85356 K
    7
    6016
    disp+work.EXE
    [WP] CHE_00
    16084 K
    16084 K
    67372 K
    67372 K
    3
    484
    disp+work.EXE
    [WP] CHE_00
    16084 K
    16084 K
    67372 K
    67372 K
    3
    2268
    disp+work.EXE
    [WP] CHE_00
    16080 K
    16080 K
    67372 K
    67372 K
    3
    584
    disp+work.EXE
    [WP] CHE_00
    19112 K
    19112 K
    85360 K
    85360 K
    4
    6064
    disp+work.EXE
    [WP] CHE_00
    30972 K
    30972 K
    81696 K
    85356 K
    7
    4228
    disp+work.EXE
    [WP] CHE_00
    30376 K
    30376 K
    81488 K
    85356 K
    7
    5980
    disp+work.EXE
    [WP] CHE_00
    16080 K
    16080 K
    67372 K
    67372 K
    3
    1984
    disp+work.EXE
    [WP] CHE_00
    16080 K
    16080 K
    67372 K
    67372 K
    3
    5996
    disp+work.EXE
    [WP] CHE_00
    16080 K
    16080 K
    67372 K
    67372 K
    3
    Sum
    534240 K
    1248476 K
    M  *** ERROR => ThShMCreate: ShmCreate SHM_ROLL_AREA_KEY failed [thxxhead.c   2598]
    M  *** ERROR => ThIPCInit: ThShMCreate [thxxhead.c   2095]
    M  ***LOG R19=> ThInit, ThIPCInit ( TSKH-IPC-000001) [thxxhead.c   1532]
    M  in_ThErrHandle: 1
    M  *** ERROR => ThInit: ThIPCInit (step 1, th_errno 17, action 3, level 1) [thxxhead.c   10534]

    M  Info for wp 0

    M    pid = 6120
    M    severity = 0
    M    status = 0
    M    stat = WP_RUN
    M    waiting_for = NO_WAITING
    M    reqtype = DP_RQ_DIAWP
    M    act_reqtype = NO_REQTYPE
    M    rq_info = 0
    M    tid = -1
    M    mode = 255
    M    len = -1
    M    rq_id = 65535
    M    rq_source =
    M    last_tid = 0
    M    last_mode = 0
    M    semaphore = 0
    M    act_cs_count = 0
    M    csTrack = 0
    M    csTrackRwExcl = 0
    M    csTrackRwShrd = 0
    M    mode_cleaned_counter = 0
    M    control_flag = 0
    M    int_checked_resource(RFC) = 0
    M    ext_checked_resource(RFC) = 0
    M    int_checked_resource(HTTP) = 0
    M    ext_checked_resource(HTTP) = 0
    M    report = >                                        <
    M    action = 0
    M    tab_name = >                              <
    M    attachedVm = no VM

    M  *****************************************************************************
    M  *
    M  *  LOCATION    SAP-Server I3LSERVSAP1_CHE_00 on host I3LSERVSAP1 (wp 0)
    M  *  ERROR       ThInit: ThIPCInit
    M  *
    M  *  TIME        Sun Dec 07 13:06:01 2008
    M  *  RELEASE     700
    M  *  COMPONENT   Taskhandler
    M  *  VERSION     1
    M  *  RC          17
    M  *  MODULE      thxxhead.c
    M  *  LINE        10754
    M  *  COUNTER     1
    M  *
    M  *****************************************************************************

    M  PfStatDisconnect: disconnect statistics
    M  Entering TH_CALLHOOKS
    M  ThCallHooks: call hook >BtcCallLgCl< for event BEFORE_DUMP
    M  ThCallHooks: call hook >ThrSaveSPAFields< for event BEFORE_DUMP
    M  *** ERROR => ThrSaveSPAFields: no valid thr_wpadm [thxxrun1.c   723]
    M  *** ERROR => ThCallHooks: event handler ThrSaveSPAFields for event BEFORE_DUMP failed [thxxtool3.c  261]
    M  Entering ThSetStatError
    M  ThIErrHandle: do not call ThrCoreInfo (no_core_info=0, in_dynp_env=0)
    M  Entering ThReadDetachMode
    M  call ThrShutDown (1)...
    M  ***LOG Q02=> wp_halt, WPStop (Workproc 0 6120) [dpnttool.c   333]

    Hi Chandra
    If you look at the DEV_w0 log you can see the work process are not comming you as they are not getting enough shared memory see this error message
    " Can't find free space for Shared Memory (Size=720000 KB) "
    Please review the parameter changes made by you in Instance profile before restart of instace. Check the values of these parameters and if you are not sure of the value changed by you  undo the parameter changes made before the instace restart
    Restart the instance again after these changes in instance profile. for now you can change the instace profile file from OS but don't forget to import this changed profile when instace is up
    if you did not changed any Profile parameters, check the physical memory available. chance could you some hardware memory issue. get your os team to check.
    Its a clear case of memory issue ..
    Rajeev

  • How can i browse using webbrowser to many pages one by one and waiting for each page to be completed loaded ?

    I have this method:
    string filename = "";
    private void GetHtmls()
    for (int i = 0; i < numberofforums; i++)
    uri = sourceUrlId + forumsIds[i] + sourceUrlNumber + 1;
    filename = uri.Substring(49);
    webBrowser1.Navigate(uri);
    And in the document completed event:
    string forums;
    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    if (e.Url.ToString() == uri)
    if (retrivedForumsInfo == true)
    targetHtmls = (combinedHtmlsDir + "\\"+ filename + ".txt");
    htmlloaded = true;
    StreamWriter write = File.CreateText(targetHtmls);
    write.Write(webBrowser1.DocumentText);
    write.Close();
    The problems are:
    1. When it's getting to the completed event already it's saving the text file with the id number of the second one in the ID's list.
        If in the method GetHtmls i used a breakpoint and see that forumsIds is 93 the first one when it's getting to the completed event  i see that the id there is already the second one like the loop continue or something.
       And if i will wait with the break point and click continue after some seconds the id will be the fourth or fifth depend on how long i'm waiting before click continue.
    2. When it's getting to the completed event after saving the text file it's not coming back to the GetHtmls method and not continue the loop and not navigating to the next page.
    I need to do it this logic:
    Make for loop navigate to the first page now wait somehow when it finished to save the text file of the first page in the completed event only then jump back to the GetHtmls method and continue the loop navigate to the second page and again wait/hold untill
    saving the text file of the seocnd page in the completed event. And so on all the loop in the GetHtmls.

    I tried it this way now and it's working untill the variable count is 5 then it stop and never continue i can't figure out why it stop and why when it's getting to 5(It's doing the 5 time but then stop and not continue).
    In the top of the form i did:
    private int counter = 1;
    private int countpages = 1;
    private int forumId = 0;
    private string uri;
    private bool htmlloaded = false;
    Then in the GetHtmls method:
    string filename = "";
    private void GetHtmls()
    uri = sourceUrlId + forumsIds[0] + sourceUrlNumber + 1;
    filename = uri.Substring(49);
    webBrowser1.Navigate(uri);
    Then in the document completed event:
    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    if (e.Url.ToString() == uri)
    if (retrivedForumsInfo == true)
    targetHtmls = (combinedHtmlsDir + "\\" + filename + ".txt");
    StreamWriter write = File.CreateText(targetHtmls);
    write.Write(webBrowser1.DocumentText);
    write.Close();
    htmlloaded = true;
    timer1.Enabled = true;
    Then in timer1 tick event:
    private void timer1_Tick(object sender, EventArgs e)
    if (htmlloaded == true)
    uri = sourceUrlId + forumsIds[counter] + sourceUrlNumber + 1;
    filename = uri.Substring(49);
    webBrowser1.Navigate(uri);
    htmlloaded = false;
    timer1.Enabled = false;
    counter++;
    countpages++;
    I tried to use try and catch and a break point i couldn't find why it stop and what make it stop and what stopped ? Maybe the timer1 never continue ? But if the timer not continue why it stop when counter is 5 ?
    The number of id's in the List<int> forumsIds is 547 and it's equal to the number of forums 547.
    I still can't figure out why it stop on counter 5 and what make it stop.

  • My program stops and i don't know why...

    I am not sure if i have a problem with my code or the VM but I'm assuming it's my code and hoping someone can help. I already searched through the forums and the bug database and I found some things I thought could maybe be my problem but after more testing the fixes and workarounds didn't work...
    It is a middleware between clients and database server all in java.
    The main thread invokes a thread that accepts socket connections and adds them to a connection queue (LinkedList). Various worker threads in a ThreadGroup wait and work with the connections as they come in. All this works correctly. Unfortunately my app is now displaying the unwanted characteristic of coming to an abrupt stop (not shutting down correctly) in an erratic manner. If no clients ever connect the app will sit and wait just fine (over 30 hours in 1 test until I stopped it) as soon as one connection is made however the app appears to be doomed. It will just stop anywhere between instantly and 10 minutes after the last connection is closed. Usually the span is between 2 and 3 minutes but it varies widely. It also will stay alive if another client connects, basically if the server is busy things are fine but when it is twiddling its thumbs waiting it just halts.
    Here is what the orginal code looks like...
    while(qOpen){
      Socket s = null;
      try{
        s = ss.accept();
      }catch(IOException clientConnectError){
        continue;     
      try{
        rq.addConnection(s);
      }catch(ConnectionQueueException closed){
        // if the queue is closed attempt to close the socket either way set our flag to closed so we exit the loop
        try{
          s.close();
        }catch(IOException clientCloseError){}     
        qOpen = false;          
    // the next line does not show up when the server stops
    System.out.println("Server Shutting down...");i thought maybe my code was doing something bad somewhere and I had an uncaught exception or error such as outofmemory. So I altered the code slightly to trap any errors or exceptions that were possibly coming down so I would know where to debug.
    Altered code
    while(qOpen){
      try{
      Socket s = null;
      try{
        s = ss.accept();
      }catch(IOException clientConnectError){
        continue;     
      try{
        rq.addConnection(s);
      }catch(ConnectionQueueException closed){
        // if the queue is closed attempt to close the socket either way set our flag to closed so we exit the loop
        try{
          s.close();
        }catch(IOException clientCloseError){}     
        qOpen = false;          
      }catch(Throwable thrown){thrown.printStackTrace();}
    // the next line does not show up when the server stops
    System.out.println("Server Shutting down...");The server stops and prints out nothing.
    Finally I thought maybe something bad is happening to the thread group. So I added another thread that loops and prints out some information about the ThreadGroup....
    Thread Group Information
    Active Count : 8
    Is Daemon : false
    This prints out like this exactly the same each time including the iteration just before everything comes to a halt.
    So I am stuck, (1)the app is not shutting down properly, (2)I cannot find (or trap) an error that is causing it to stop and (3) nothing wierd seems to be happening to my group of workers. What else can I do to find this error. Is this possibly a vm bug or is it more likely a code problem. I am not asking for anyone to solve my code if that is the problem but I have no more ideas about how to find out what the problem is. In case it helps here is the output from java -version
    java version "1.3.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

    case? If so, I suggest that -- if you haven't already
    done so -- that you build a prototype of your project
    consisting only of the socket code that you're having
    problems with. This will obviate the possibility that
    something else in some seemingly unrelated piece of
    code is causing the problem. If you get that to work,
    then add pieces to your prototype until it converges
    with what you have now. That will allow you to
    isolate the piece causing the problem.This is not my first work with sockets in java but I think I may have to do the speration you mention to isolate the problem.
    Secondly, I'm writing this because I have I had a
    similar problem with sockets in C when I was first
    playing with them, and I know that deep down in the
    OS, sockets are sockets, pretty much the same as they
    ever were, and so my advice might carry to JAVA.
    First of all, you need to find out if the connections
    you are creating are blocking or non-blocking,
    including the server socket. If they are blocking,
    which I believe used to be the default, that means
    that your code will stop there and appear to hang
    when what is really happening is that it is just
    waiting for the next piece of data (or next
    connection, for a queue socket). If you've already
    got all that worked out, I recall that C sockets
    would cause an error condition on the port which, if
    not caught and handled, would really gunk things up
    because the port would show up as readable (using the
    tools for handling non-blocking sockets) but there
    would never be any data on it, which originally
    caused my software to hang while trying to read the
    nonexistent data. Go check those things and come
    back.Yes there are blockng calls... s = ss.accept() is a blocking call. Here is the code with more comments as I understand what is happening.
    Socket s = null;
    try{
      // this next line is a blocking call. This thread (only the one) will be waiting until a connection attempt is made
      s = ss.accept();
    }catch(IOException clientConnectError){
      // the accept method may throw an IOException this is
    an error to trap in the client debugging stage and otherwise I don't care so ignore it and jump to the next iteration of the loop.
      continue;
    try{
      // here the whole socket is added to a queue of sockets. 
      rq.addConnection(s);here is my code for the ConnectionQueue of sockets...
    public class ConnectionQueue{
      private LinkedList lElements;
      private boolean bOpen;
      public ConnectionQueue(){
        lElements = new LinkedList();
        bOpen = true;
    /** Adds the socket to the end of the queue.
    @param s The socket to add to queue.
    @exception ConnectionQueueException If this queue has been closed.*/
      public synchronized void addConnection(Socket s)throws ConnectionQueueException{
        if(!bOpen){
          throw new ConnectionQueueException("Request Queue closed.");     
        lElements.addLast(s);
        notify();
    /**Returns the socket at the beginning of the queue.     
    @exception ConnectionQueueException If the queue is closed and empty.*/
      public synchronized final Socket getConnection()throws InterruptedException,ConnectionQueueException{
        if((!bOpen)&&(lElements.size()<=0)){
          throw new ConnectionQueueException("Request Queue Closed");
        while(lElements.size()<=0){
          wait();
          if((!bOpen)&&(lElements.size()<=0)){
            throw new ConnectionQueueException("Request Queue closed.");
        try{
          return (Socket) lElements.removeFirst(); 
        }catch(ClassCastException bad){
          throw new ConnectionQueueException(bad.getMessage());
    /** Closes the queue. A closed ConnnectionQueue will not accept any additional sockets through addConnecion(Socket s). Sockets will still be returned by getConnection() for a closed ConnectionQueue while there are still queued sockets.*/     
      public synchronized void close(){
        bOpen = false;
        notifyAll();
         Well all this code works as it is supposed to. Also the app only dies (and when I mean dies/stops it is dead no more process, no more vm, nothing) when nothing is happening as opposed to if it is really busy in which case it is fine.

  • How to stop and start MDBs to listen for JMS messages

    Hello! This might be more of an architecture question rather than a technical questing, but I post it here, in the lack of a better place...
    For several years I have been using Webster and Webster MQ to send messages back and forth to clients. The architecture for the middleware platform has been designed around the functionality of ListenerPorts. Listenerports is a Webster functionality that let you "stop" and start to listen to JMS messages for a given MDB either by admin console, or by JMX.
    The arhitecture we used was something like this :
    1.Client sends a persistent message to a queue. (order)
    2. An MDB pics up the order message, calls a SessionBean that "fronts" the IIOP back end system.
    This is quite "out of the box" architecture, but we used the Listenerports to solve a stability problem for our back end system.
    The backEnd system was quite unstable, so the EJB threw an exception (typically because of timeout or connection refused) back to the MDB.
    The Listenerport was "defined" to handle 3 errors before stopping, so the MDB resent the message twice before the listenerport automatically stopped. The nice thing about this feature was that the client could continue to send orders, and was not bothered when the back end system was down.
    When the backEnd system was up and running, we could start the listenerport and it was all back to normal state. We even had a start script that checked the state of the listenerport every 30 minute, and started it automatically if it was stopped, making the admin task of starting the MDB unnecessary..
    Now.. Why am I telling this story..
    I would like to know how this could be done using "clean" J2EE technologies..That is..Not using any technology that is not portable..
    I`m playing with glassfish at home, and it struck me that there is nothing in the J2EE spec that defines the functionality described above ? Am i missing something ?
    I Do not want to stop My application because the back end system is down? That is the only way (i know of) that i can "stop" to listen for messages..
    I can put all the messages on an error queue when the backbend system is down, but that would lead to more code just to handle the error messages. Maybe the easiest way to solve this is to "move" (programmatically) all messages from the error queue over to the "standard" queue every XX minute, but somehow that sounds "wrong"
    Can anyone give me some advice to how this problem situation should be solved ? I`m interested in the solution both from an architectural perspective and from a more technical perspective..
    Best regards
    Hans-Jacob Melby

    Breakpoints, whether normal or conditional, are just meant for debugging of your code.  I had the sense from your question that the pausing you want to do is a part of normal operation of your code.  I would NOT recommend using a breakpoint for that situation.  It would bring up the block diagram showing the breakpoint when it occurs.  A user besides the programmer would not know what to do in that case.
     Yes, both the inner and outer loops would have shift registers.
    Putting a case structure with a small while loop inside the "Pausing Case" is doable.  It just depends on what you are doing or waiting for while the program operation is "paused".

  • I just put itunes upeate 11 on and now itunes will not run. I get an error that sys iTunes has stopped and windows is sutting it down. I reinstalled 10.7 and it will not run eather now.

    I just put itunes upeate 11 on and now itunes will not run. I get an error that sys iTunes has stopped and windows is sutting it down. I reinstalled 10.7 and it will not run eather now.

    C Mawle wrote:
    Thanks.  I have followed all the instructions as recommended and nothing has worked so it looks like the restore/update may have been interrupted - would loss of internet connection do this?
    Yes it would, possibly even brick it.
    Have successfully connected my ipod nano with iTunes so looks like the device driver is working.
    Can I use my ipod nano USB connector to check?
    It is not much help to you, since the device that you need still not recognized.
    Anyway looks like I may have to swallow the loss of data.  Have set-up a call for tomorrow with Apple support so will wait until after this before doing the factory restore!
    Good luck, but if you expect miracle from that call good luck again.

  • How to solve the syncing issues of apps downloaded? They are stuck on "loading" and "waiting"

    Syncing issues from iTunes to iPad. Apps are showing as "loading" and "waiting"

    I had the same issue and tried several options like rebooting, resyncing, deleting and reinstalling apps, restarting the network connection but none of them worked. Eventually I opened iTunes on my iPhone (not on Mac) to find that it had two pending downloads that was stopping the rest of the apps from loading fully.  You need to cancel them by swiping left to right over the listed apps and select cancel/delete. It worked for me.  Good luck!

  • Stop and start the system via the SAP GUI

    ........ although I don't know the answer!
    We have SAP running on an iSeries/DB2 format.
    And we of course have stopped and started our SAP systems many times before via an iSeries screen.
    One thing we have never had to do, is stop and start the system via the SAP GUI.
    Is this possible? If so, how is it done?
    Surprisingly difficult to find a solution online.
    Edited by: Juan Reyes on Aug 10, 2010 11:10 AM

    Paui,
    You can also do a soft shutdown, which waits till the active users/sessions are logged out (Draing out the sesstions) and no more new users are allowed to login during that time.
    Goto SM51, select the instace/server you want to stop then menu --> Goto --> Server Name --> Administration --> Shut Down Server (soft).
    Here you can also select a hard shutdown if the situation demands by following the same menu path.
    Even though your question is answered but I still wanted to update you the options to select.
    -Mahesh

Maybe you are looking for

  • Hiding the two region in same position

    hi all, I have a region called addexist under that p6_search(txtbox),p6_item(hidden),p6_item2(hidden),p6_searchbutton,p6_viewall. Under the region AddExist i created a sub regions named hidden1(Report type=Sql Query) and hidden2(Sql Query). I have cr

  • Calendar and call not showing in Notification Centre in iOS 6.0.1 in iPhone 4S

    After i updated my 4S to iOS 6.0.1,Calendar Events and Call wont show up in the Notification Centre. I need to personally edit the Calendar Events fr them to show up. P

  • VLD-1141: Internal error during mapping generation.

    I am getting the "VLD-1141: Internal error during mapping generation" error when deploying a mapping. This mapping was previously working fine. As part of a re-factoring effort, for all the underlying tables and views, we replace 2 existing columns w

  • Making a PDF from LAbView Report

    Hi, How do can I make an PDF-file of my LabView report? I was thinking of using Adobe PDF writer and just printing the report a PDF-file. Do I have to do anything else that just install Adobe Writer or do I have to do some kind of configuration? Is i

  • How does battery charge work ThinkPad T430s

    I recently bought a Lenovo ThinkPad T430s 2356-LRG and was wondering how the charge technology worked. I have searched around and looked in the manual but I couldn't find a good answer. My questions is that I use the notebook alot on AC power. And of