Doua Beri
Doua Beri

Reputation: 10949

java library: socket communication between 2 or more java applications

I'm looking for a java library that help me send information between 2 or more running java applications that are on the same or different machines(different networks).

I'm looking for a TCP socket communication.

I know I can implement my own format, but I'm looking for something already done.

I'm also looking for something simple that is not resource hungry.

Thanks

Upvotes: 1

Views: 387

Answers (2)

user207421
user207421

Reputation: 310893

java.net.Socket plus java.io.DataInputStream and java.io.DataOutputStream.

RMI.

RMI/IIOP.

XML-RPC.

JAXB or any other implementation of SOAP.

And that's not exhaustive.

Upvotes: 2

Rajiv Makhijani
Rajiv Makhijani

Reputation: 3651

To do simple socket communication in Java, the built in libraries are fairly straightforward: See http://www.oracle.com/technetwork/java/socket-140484.html

In terms of the format of data to send across the socket connection. One way to go is Java serialization, but I would not recommend this unless you know the exact environment you're running on as it is not a very flexible/portable way to go. Instead, maybe take a look at something like google-gson (http://code.google.com/p/google-gson/) which is a low-profile, easy-to-use library for encoding from Java class instances to Json and vice-versa. Json is a very portable format and you can use it with almost any language/platform.

Upvotes: 1

Related Questions