开发者

java library: socket communication between 2 or more java applications

开发者 https://www.devze.com 2023-03-31 17:15 出处:网络
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 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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消