Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Let me start from the back:</p> <blockquote> <p>Is there a better way to go about trying to get two servers to connect?</p> </blockquote> <p>Absolutely. The easiest path would be to take any JMS system like <a href="http://activemq.apache.org/" rel="nofollow">ActiveMQ</a>, then use that to solve your problem. This solves a lot of very hard problems for you, and makes your entire system more robust. (Plus, code you don't write has a lot less bugs than code you do.)</p> <p>Alternately, <a href="http://www.oracle.com/technetwork/java/javase/tech/index-jsp-136424.html" rel="nofollow">Java RMI</a> is a fine choice for invoking methods remotely, or you could dig out <a href="http://msgpack.org/" rel="nofollow">MessagePack RPC</a>, or <a href="http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns#RPC_Implementations" rel="nofollow">Protocol Buffers based RPC</a> to implement your operations.</p> <p>Finally, HTTP is an awesome choice for this. Seriously, there are so many excellent HTTP client and server choices available that you can embed in your Java application, and which will solve so many of these problems for you.</p> <blockquote> <p>I am working on trying to get two servers communicating with each other. I know that I need to use threads but I cannot figure out how to set it up.</p> </blockquote> <p>Why do you think you need threads? More specifically, think about what parts of the system need to be waiting and listening for messages, or sending them, concurrently with other parts of the system.</p> <p>Then, and only then, add threads to meet those needs. (Ideally, only if you can't solve the problem with non-blocking or callback based solutions.)</p> <p>Anyway, my advice to you: don't write this yourself. Use an existing solution. It will hurt a lot less.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload