I currently have a Java application that communicates with an Android application by Java Sockets and I would like it to communicate the same way with a web application. Will both be possible simultaneously? If so, what would be the easiest way?
I currently have a Java application that communicates with an Android application by Java
Share
Yes you can!
A socket is simply a way for your program to access the network, many programming languages have support for sockets.
Your program can have several sockets open simultaneously and thus it is no problem for it to open one connection to talk with your android phone and another that communicates with a webapplication.
However sockets might not be the easiest thing to use. Since your programming in java, and you say that you want your application to communicate with android and a webapplication I’m guessing that the communication will start from the application that you’ve written.
If that is indeed the case you should check out java.net.HttpUrlConnection. which should cover your needs.
If your application is acting more like a server, handling request itself you should check out java.net.ServerSocket