Home » Community » Newbie corner » Socket Communication 101
|
Re: Socket Communication 101 [message #39676 is a reply to message #39673] |
Tue, 16 April 2013 22:43 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Thanks for the link.
The socket is just 'sending' data from the Upp app to a Java app.
There is no internet connection necessary but I do have a 100 MB connection.
The errors were shown up in the Java display app.
Here are a few lines from a file I open in Upp
// SW corner 35.028940,-117.970440,804.4 from S20 35.028928,-117.970460
35.04361500,-117.96188300
c,35.036235,-117.961830,35.036335,-117.961730
c,35.043615,-117.961883,35.028850,-117.961610 // correct ?? N 1/4 corner
c,35.043617,-117.962056,35.028850,-117.961610 // old N 1/4 corner
c,35.036291,-117.970649,35.036184,-117.952831
c,35.028940,-117.970440,35.028759,-117.952780
c,35.028759,-117.952780,35.043566,-117.952887
c,35.043663,-117.970880,35.043617,-117.962056
c,35.043617,-117.962056,35.043566,-117.952887
c,35.028940,-117.970440,35.043663,-117.970880 //W
// Farm
c,35.036291,-117.970649,35.036235,-117.961830
c,35.036235,-117.961830,35.037156,-117.961853
c,35.037156,-117.961853,35.037189,-117.966238
c,35.037189,-117.966238,35.039954,-117.966357
c,35.039982,-117.970770,35.039954,-117.966357
Each line that starts with c, is a path with two points and the other lines are ignored. Sometimes survey data is represented degrees, minutes and seconds rather than decimal degrees so the data is 'formatted' to decimal degrees and checked for like a latitude greater than 90 degrees, etc..
Most survey data is E->W or N->S that I am using.
Sending the data as a packet for each line without an adequate Sleep time many of the paths are diagonal as the points are out of order. Using print statements shows the data is not in order also.
Putting all the data in one buffer and sending in one packet all the data is received and displayed correctly.
Using shared memory between C++ and Java may be faster but was more complicated so a socket is being used.
This is displayed correctly, the two diagonal lines near the bottom is intended.
http://www.nlneilson.com/wwposts/Survey-Paths.png
The upper left is the Upp app.
This displays the errors:
http://www.nlneilson.com/wwposts/Survey-Paths-errors.png
[Updated on: Tue, 16 April 2013 23:31] Report message to a moderator
|
|
|
|
Re: Socket Communication 101 [message #39831 is a reply to message #39679] |
Sun, 05 May 2013 02:45 |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Yes the problems seem to be on the java end.
Data is received but apparently there is no positive method to keep the data in order. Each 'line' represents two points. For the points to get messed up so they are not consistent with the path that is supposed to be drawn gives the diagonal lines.
The transfer is very fast whether sent separately or as one buffer. The time taken by the java app to change the format if necessary, error handling and draw it while additional lines are actually being received into some unknown que.
C++ and Upp are very good and most problems end up being in java.
|
|
|
Goto Forum:
Current Time: Mon Apr 29 08:31:35 CEST 2024
Total time taken to generate the page: 0.02960 seconds
|