-2

I need to create a Java application (App A) that listens on a TCP port, accepts data being sent from PHP or C++ applications, does some processing and sends the data back, from App A to PHP / C++ applications.

What is the most efficient way to pack data to be send from C++/PHP to Java and back ?

What if all applications are running on same machine ? is there a non-TCP method ?

Thank you very much.

florian
  • 35
  • 7
  • Human time is nearly always more expensive than CPU time or network bandwidth. Unless you have a specific reason to need something else, use JSON over HTTP. – chrylis -cautiouslyoptimistic- Jan 16 '17 at 04:20
  • the use of RESTful webservices will do the job! There are others as well. but REST is the BEST – Faraz Jan 16 '17 at 04:20
  • 2
    If all applications are running on the same machine, the term you are looking for is "inter-process communication" or IPC. The types of IPC available vary significantly from one platform to the next. – MrEricSir Jan 16 '17 at 04:32
  • If you want something more efficient than JSON there are Protocol Buffers. But you probably don't need to worry about micro-optimization – Patrick Parker Jan 16 '17 at 04:42

2 Answers2

1

http://lessons.livecode.com/m/4071/l/12924-how-to-communicate-with-other-applications-using-sockets

hi please go through the above link .i think u will get some useful tips from the above link

reshma s s
  • 51
  • 6
  • This post isn't an actual attempt at answering the question. Please note [StackOverflow doesn't work like a discussion forum](http://stackoverflow.com/tour), it is a Q&A site where every post is either a question or an answer to a question. Posts can also have [comments](http://stackoverflow.com/help/privileges/comment) - small sentences like this one - that can be used to critique or request clarification from an author. This should be either a comment or a [new question](http://stackoverflow.com/questions/ask) – ρяσѕρєя K Jan 16 '17 at 06:03
1

What if all applications are running on same machine ? is there a non-TCP method ?

I assume you don't want to use sockets . Using IPC(inter - process - comunication) might be of a great help . This can be done in to ways :

  • Create a pipe between processes
  • Use SendMessage Api in order to send a message structure .

For the second option this link may be of help : Use WM_COPYDATA to send data between processes

Community
  • 1
  • 1
Reznicencu Bogdan
  • 902
  • 2
  • 11
  • 28