1 2 3 4 5 6 Previous Next 83 Replies Latest reply: Jun 24, 2012 9:28 AM by 938489 Go to original post RSS
      • 30. Re: Trying to capture line feed or carriage return
        938489
        Dear Ejp,
        Tried your new suggestion it did not work either. What we notice now is that if we add many w.flush() at times it does some trick and allow more data to come in before it gets corrupted. We have notice all the logs file of the device and looks fine. Another thing the device engineer have worked on C# and it works fine without any problem the server could receive hundreds of data with out any corruption.
        • 31. Re: Trying to capture line feed or carriage return
          jschellSomeoneStoleMyAlias
          935486 wrote:
          Dear Jschell,
          The output for the statement corresponds to ASCII int values.
          Not sure what that means but to cover both possibilities.
          1. You posted output that wasn't ASCII characters.
          2. I know what the line prints, what I want to see is the actual values.
          • 32. Re: Trying to capture line feed or carriage return
            938489
            Dear Jschell,
            Below is an example.

            Clean version
            $SSM,354776032130814,05827,006,L001,V,0000.0000,N,00000.0000,E,000.0,000.0,00.0,08:10:56 31-05-12,9.58,D7,0,6D,1,000*
            
            36,83,83,77,44,51,53,52,55,55,54,48,51,50,49,51,48,56,49,52,44,48,53,56,50,55,44,48,48,54,44,76,48,48,49,44,86,44,48,48,48,48,46,48,48,48,48,44,78,44,48,48,48,48,48,46,48,48,48,48,44,69,44,48,48,48,46,48,44,48,48,48,46,48,44,48,48,46,48,44,48,56,58,49,48,58,53,54,32,36,83,83,77,44,51,53,52,55,55,54,48,51,50,49,51,48,56,49,52,44,48,53,56,50,55,44,48,48,54,44,76,48,48,49,44,86,44,48,48,48,48,46,48,48,48,48,44,78,44,48,48,48,48,48,46,48,48,48,48,44,69,44,48,48,48,46,48,44,48,48,48,46,48,44,48,48,46,48,44,48,56,58,49,48,58,53,54,32,51,49,45,48,53,45,49,50,44,57,46,53,56,44,68,55,44,48,44,54,68,44,49,44,48,48,48,42
            Corrupted version
            ¦ÃÃM,354776032130814,05827,006,L001,V,0000.0000,N,00000.0000,E,000.0,000.0,00.0,08:10:56 31-05-12,9.58,D7,0,6D,1,000*
            
            166,202,213,77,44,51,53,52,55,55,54,48,51,50,49,51,48,56,49,52,44,48,53,56,50,55,44,48,48,54,44,76,48,48,49,44,86,44,48,48,48,48,46,48,48,48,48,44,78,44,48,48,48,48,48,46,48,48,48,48,44,69,44,48,48,48,46,48,44,48,48,48,46,48,44,48,48,46,48,44,48,56,58,49,48,58,53,54,32,36,83,83,77,44,51,53,52,55,55,54,48,51,50,49,51,48,56,49,52,44,48,53,56,50,55,44,48,48,54,44,76,48,48,49,44,86,44,48,48,48,48,46,48,48,48,48,44,78,44,48,48,48,48,48,46,48,48,48,48,44,69,44,48,48,48,46,48,44,48,48,48,46,48,44,48,48,46,48,44,48,56,58,49,48,58,53,54,32,51,49,45,48,53,45,49,50,44,57,46,53,56,44,68,55,44,48,44,54,68,44,49,44,48,48,48,42
            • 33. Re: Trying to capture line feed or carriage return
              EJP
              At this stage I would start replacing hardware. The NIC for example.

              Crosspost noted.
              • 34. Re: Trying to capture line feed or carriage return
                938489
                Dear Ejp,
                We have tried a new server even the same too. Could be the network connection is causing it? I have added few of this just to add some delay effect before write and flush. It looks like first time it connects there is a corruption there after it could send nearly 50++ before the next corruption happens. The whole scenario is very dynamic and unpredictable when the corruption occurs.
                for(int d=0 ; d<10000000 ; d++) {
                 }
                • 35. Re: Trying to capture line feed or carriage return
                  EJP
                  It could be the device itself not coping with too frequent acknowledgments. Are they acknowledgements, or are they really requests for an update?

                  You should use a sleep rather than a spin loop to implement delays.
                  • 36. Re: Trying to capture line feed or carriage return
                    938489
                    Dear Ejp,
                    Those are acknowledgments to say that the message is already received by the server then the device will send the next message to the server.Maybe what you say is true the device could not cope because on a normal scenario where is no message being stored in buffer it works fine only when the buffer is full (during the time where is the no communication between the device and server) this behaviors shows up. I tried sleep it does not work in the run function so that is why I opt to this option.
                    • 37. Re: Trying to capture line feed or carriage return
                      EJP
                      In other words the @@ message does control pacing, so you need to investigate how fast the device can go.

                      Sleep does indeed 'work in the run function', but of course you have to catch the InterruptedException that it can throw. Don't describe compile errors as 'does not work', and don't invent poor runtime workarounds for simple compile-time problems.
                      • 38. Re: Trying to capture line feed or carriage return
                        938489
                        Dear Ejp,
                        Ok manage to set the delay to say 5 seconds before and 2 seconds after the write and flush things looks a bit better. It could be right device could not handle many of the acknowledgement. But they all come one after another and not together so why would there be a problem.
                        try {
                                        
                                             Thread.sleep(5000);                                         
                                             } catch (Exception e) {
                                               e.printStackTrace();
                                             }
                        • 39. Re: Trying to capture line feed or carriage return
                          938489
                          Dear Ejp,
                          Even still it has corruption by building the delays. So what is your guess then based on your experience could it be the way how the socket is connected to the device but that is standard on java basis right.
                          • 40. Re: Trying to capture line feed or carriage return
                            EJP
                            My experience tells me it is a hardware problem. It is clear from what you have said above about sniffing the network that the corruption is happening at the source device, not within Java or your receiving host. In any case Java doesn't corrupt data like that, neither does TCP. Otherwise the Internet, and these forums for example, would be an impossibility. You are just going to have to mount a full scale investigation of exactly what factors cause the following incoming message to be corrupt. For example, is it only one message that is corrupt, or several, or all the following messages? Perhaps also you should just discard the messages that are clearly corrupt. Maybe there is more to the device than you are presently aware of: I would have a good look at its interface description.
                            • 41. Re: Trying to capture line feed or carriage return
                              938489
                              Dear Ejp,
                              I am in agreement with you that the device is giving problem more of the firmware I guess. But the problem is that if we investigate the log file from the device its show no corruption at all. Yes now we are actually discarding the corrupt message but the problem is that the device will keep waiting for the acknowledgement for the sent message and there after it goes into timeout and we break the socket. Then another socket will be created off course this is another problem and resource wastage.
                              • 42. Re: Trying to capture line feed or carriage return
                                EJP
                                So acknowledge the message but ignore it. It is sounding like the device's NIC to me.
                                • 43. Re: Trying to capture line feed or carriage return
                                  938489
                                  Yes that is killer part because if we just send the acknowledgment means we at the server will be missing the data but at the device log will show successfully sent.
                                  • 44. Re: Trying to capture line feed or carriage return
                                    EJP
                                    So log the corruption!