在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:zeromq/jeromq开源软件地址:https://github.com/zeromq/jeromq开源编程语言:Java 100.0%开源软件介绍:JeroMQPure Java implementation of libzmq (http://zeromq.org). Features
Unsupported
ContributingContributions welcome! See CONTRIBUTING.md for details about the contribution process and useful development tasks. UsageMavenAdd it to your Maven project's <dependency>
<groupId>org.zeromq</groupId>
<artifactId>jeromq</artifactId>
<version>0.5.2</version>
</dependency>
<!-- for the latest SNAPSHOT -->
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jeromq</artifactId>
<version>0.5.3-SNAPSHOT</version>
</dependency>
<!-- If you can't find the latest snapshot -->
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories> AntTo generate an ant build file from mvn ant:ant Getting startedSimple exampleHere is how you might implement a server that prints the messages it receives and responds to them with "Hello, world!": import org.zeromq.SocketType;
import org.zeromq.ZMQ;
import org.zeromq.ZContext;
public class hwserver
{
public static void main(String[] args) throws Exception
{
try (ZContext context = new ZContext()) {
// Socket to talk to clients
ZMQ.Socket socket = context.createSocket(SocketType.REP);
socket.bind("tcp://*:5555");
while (!Thread.currentThread().isInterrupted()) {
// Block until a message is received
byte[] reply = socket.recv(0);
// Print the message
System.out.println(
"Received: [" + new String(reply, ZMQ.CHARSET) + "]"
);
// Send a response
String response = "Hello, world!";
socket.send(response.getBytes(ZMQ.CHARSET), 0);
}
}
}
} More examplesThe JeroMQ translations of the zguide examples are a good reference for recommended usage. DocumentationFor API-level documentation, see the Javadocs. This repo also has a doc folder, which contains assorted "how to do X" guides and other useful information about various topics related to using JeroMQ. LicenseAll source files are copyright © 2007-2020 contributors as noted in the AUTHORS file. Free use of this software is granted under the terms of the Mozilla Public License 2.0. For details see the file |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论