0

I have to make a java program in which there are some processes that communicate using HTTP
sockets. But I found that there are only TCP/UDP sockets in Java.
I am little bit confused here. Is there anything like HTTP Sockets ?
Is there any library in java that provides HTTP sockets ?
The processes in my program run on the same system spawned by a single main java program.
I need some way to communicate one process with the other.

4
  • HTTP uses TCP sockets at a lower level. Try using an HTTPClient library to send your requests Commented Mar 8, 2021 at 10:45
  • as @jr593 mentioned HTTP protocol (application layer) is an upper layer working on top of Sockets (transport layer). Check stackoverflow.com/questions/15108139/… Commented Mar 8, 2021 at 10:51
  • Java has an HttpClient class in the java.net.http package, and an HttpServer class in the com.sun.net.httpserver package. HTTP may or may not be the most optimal choice for local IPC, depending on what you are trying to accomplish. What is wrong with using plain TCP with a custom protocol? Commented Mar 8, 2021 at 19:17
  • This related question gives code examples and Java APIs to implement an HTTP server. Commented Jun 6, 2021 at 17:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.