Search code examples
javamessagemobile-phones

Is there a way to communicate to a Java Swing app running on a PC from a cell phone?


I've developed a Java Swing app running on a PC to match skill sets from resumes to client requirements, e.g. : client asked for Java,Html,Sql, it will load all resumes and extract text from them then search for the above keywords and find the persons with the skills.

But my boss asks : "Can I use it form my cell phone ?"

My answer is yes and no.

Yes, you can call someone running this app and search for the match and then email it to you.

No, it's not a mobile app, you can't run it from your phone.

But I'm thinking : is there a way to communicate from a cell phone to the PC running this app without using a web server ?

Like this : on the phone open a browser and enter, as address, the IP of the PC running the app, then give it a parameter, something like a url, for example : http://123.4.56.78:80/My_App?A=Java&B=Html

And in my app running on the PC at [123.4.56.78], it listens for messages on port 80, and send back the results.

Even if it can't send back the results, it can always email the results.

So the critical question is : can it get messages on a certain port sent from a cell phone ?


Solution

  • I found the answer : com.sun.net.httpserver

    There are many samples at : http://www.programcreek.com/java-api-examples/index.php?api=com.sun.net.httpserver.HttpServer

    Include a mini httpserver in a Swing app, and it will be able to communicate with a cell phone.