Results 1 to 13 of 13
Like Tree1Likes
  • 1 Post By Norm

Thread: Project Suggestions!!!

  1. #1
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Project Suggestions!!!

    Hello ! Good night everyone !

    I write my first post with the intention to know if anyone can guide me about wich is the most efficient way to develop the project in wich I 'm working right now :

    The project consists of making a Client-Server Application between two devices : One is called Server ( Raspberry Pi) and one called Client ( PC ) . Both are geographically separated and the idea is to communicate them via WiFi .

    Inside the Server ( Raspberry Pi) I have an executable in C++ , which when is executed , its constantly shows the measured temperature from a thermometer attached to the Raspberry Pi and displays it on screen with just an “printf”. This thermometer, only works in the Raspberry Pi using C libraries .

    Now, I want to develop a Client-Server Application (Maybe in Java), that let me use that C++ executable , get the data(Temperature), pass it to the application and send it to the client to be displayed in a graphical interface.

    I would like to know how I can handle correctly and effectively that temperature value ( from the executable in C++ to Java Application).

    The first thing that I thought was: into the C + + executable, save the data(temperatura) to a file. "Txt" or database, and from the main application, access them and send them to the Client… But it does not seem as efficient and "elegant".

    I would be grateful to hear your valuable suggestions .

    Regards!
    Last edited by bankoner; 10-11-2013 at 02:49 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Project Suggestions!!!

    How can data be sent between the two devices? Do they both have radios that can send and receive?
    Do they have software that can use the radios to send/receive data? What language is that software written in?
    Can Java be connected to that software say by JNI?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: Project Suggestions!!!

    Hi Norm!

    Both devices are configured to access to the internet via wifi.

    The idea was to make an app to transmit data through a socket.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Project Suggestions!!!

    If both devices are connect to the internet and have IP addresses then there shouldn't be problems for them to communicate using sockets.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: Project Suggestions!!!

    Yes! But i dont know which is the best way to handle and pass the data obtained from the c++ executable to the Java App.

    As I said, i was thinking to store the data into an .txt or send it to mysql and then, read it from the Java App.

    But i would like to know if there's something more efficient.
    Last edited by bankoner; 10-11-2013 at 03:29 AM.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Project Suggestions!!!

    way to handle and pass the data obtained from the c++ executable to the Java App.
    Send it as data between two sockets. Say the temp is 55.6. Send the floating pt number: 55.6 between the two sockets.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: Project Suggestions!!!

    Quote Originally Posted by Norm View Post
    Send it as data between two sockets. Say the temp is 55.6. Send the floating pt number: 55.6 between the two sockets.
    Sorry if I'm not understanding you much, since I'm not an advanced programmer.

    Before sending the temperature via socket between Server and Client, I must pass the temperature that i get from the c++ excecutable to the main application and then send by socket. But i dont know how to do that:

    The thing should be this:

    1) I run my Java Client-Server App.
    2) In the Server side code(Java App), i should call the c++ executable (This executable get the temperature) and THEN I should store this value in the Java code to send it to the Client via socket. But i dont know how to extract that temperature value from the executable and use it in the java main code. As i said, i was thinking to save it in a .txt and then read from the java code but i want to know if there's an most directly way to do that (whitout storing into a .txt or database).

    Thanks!
    Last edited by bankoner; 10-11-2013 at 05:13 AM.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Project Suggestions!!!

    from the c++ excecutable to the main application
    how to extract that temperature value from the executable and use it in the java main code
    Java uses JNI to communicate with a C++ program. Once the data is in the java program them a socket can be used to send the data to another device. Or the C++ program could be written to use a socket.

    On device 1:
    C++ program gets the temp and uses a socket to connect to device 2 and sends the temp
    On device 2:
    java program uses a socket to receive the temp.

    Or
    on device 1:
    C++ program gets temp and passes it to java program via JNI. Java program uses socket to send temp to device 2
    On device 2:
    java program uses a socket to receive the temp. (same as the other scheme)
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: Project Suggestions!!!

    Quote Originally Posted by Norm View Post
    On device 1:
    C++ program gets the temp and uses a socket to connect to device 2 and sends the temp
    On device 2:
    java program uses a socket to receive the temp.
    Ohhhhh, Norm!!! I did not know that I could do a socket between Java and C + +! If it's possible, that would be much more interesting and easy for my application!

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Project Suggestions!!!

    Using a socket is possible in many languages. What language is used at the other end of the connection should not be important or relevant.

    The exception would be for how primitive data is represented and what order the bytes are in.
    Last edited by Norm; 10-11-2013 at 05:46 PM.
    bankoner likes this.
    If you don't understand my response, don't ignore it, ask a question.

  11. #11
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: Project Suggestions!!!

    Thanks you so much Norm!

    One more question: I need to install the same SO on both devices to make client/server app? My RPi runs in a Linux-based operating system, but my PC works on Windows!

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,274
    Rep Power
    25

    Default Re: Project Suggestions!!!

    What is a "SO"? Do you mean OS? The OS shouldn't have any effect on using sockets to communicate between devices.
    If you don't understand my response, don't ignore it, ask a question.

  13. #13
    bankoner is offline Member
    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Default Re: Project Suggestions!!!

    Yes... I mean OS (In spanish is SistemaOperativo, excuse me for that). And thanks, i read a while ago that it doesnt have any effect as you say...

    Thanks for the help!

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2012, 06:56 PM
  2. Suggestions for project
    By Qsc in forum New To Java
    Replies: 3
    Last Post: 11-08-2011, 01:48 PM
  3. Looking for suggestions
    By tonino in forum New To Java
    Replies: 5
    Last Post: 09-26-2010, 07:17 PM
  4. any suggestions?
    By PureAwesomeness in forum New To Java
    Replies: 4
    Last Post: 01-19-2009, 07:34 AM
  5. Suggestions for my Java-project?
    By shabbee in forum New To Java
    Replies: 1
    Last Post: 01-01-2009, 10:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •