File: sockets.md

package info (click to toggle)
jeromq 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,604 kB
  • sloc: java: 51,171; xml: 851; sh: 149; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Sockets

There are multiple classes implementing socket behavior in JeroMQ.

## tl;dr: How do I construct a Socket?

Use [ZContext.createSocket][create-socket]. This returns a
[ZMQ.Socket][zmq-socket].

## zmq.SocketBase

[zmq.SocketBase][socket-base] contains low-level implementation details of
ZeroMQ socket behavior.

It should not be used directly in code that uses the JeroMQ library.

## org.zeromq.ZMQ.Socket

[ZMQ.Socket][zmq-socket] is the user-facing API for working with sockets in
JeroMQ.

Sockets are constructed by calling [ZContext.createSocket][create-socket]. This
is essential because it registers the poller with the context, so that when the
context is closed, the poller and selector resources are cleaned up properly.

## See also

* [zguide: Handling Multiple Sockets][zguide-polling]: general
  information about polling in ZeroMQ


[create-socket]: https://static.javadoc.io/org.zeromq/jeromq/0.6.0/org/zeromq/ZContext.html#createSocket(int)
[zmq-socket]: https://static.javadoc.io/org.zeromq/jeromq/0.6.0/org/zeromq/ZMQ.Socket.html
[socket-base]: https://static.javadoc.io/org.zeromq/jeromq/0.6.0/zmq/SocketBase.html
[zguide-polling]: https://zguide.zeromq.org/docs/chapter2/#Handling-Multiple-Sockets