Modifier | Constructor and Description |
---|---|
protected |
ZMQ.Socket(SocketBase base_) |
protected |
ZMQ.Socket(ZMQ.Context context,
int type)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
SocketBase |
base()
DO NOT USE if you're trying to build a special proxy
|
int |
bind(String addr)
Bind to network interface.
|
int |
bindToRandomPort(String addr)
Bind to network interface to a random port.
|
int |
bindToRandomPort(String addr,
int min,
int max)
Bind to network interface to a random port.
|
void |
close()
This is an explicit "destructor".
|
void |
connect(String addr)
Connect to remote application.
|
boolean |
disconnect(String addr)
Disconnect to remote application.
|
long |
getAffinity() |
long |
getBacklog() |
int |
getEvents()
The 'ZMQ_EVENTS' option shall retrieve event flags for the specified socket.
|
SelectableChannel |
getFD()
The 'ZMQ_FD' option shall retrieve file descriptor associated with the 0MQ
socket.
|
long |
getHWM()
Deprecated.
|
byte[] |
getIdentity() |
boolean |
getIPv4Only() |
long |
getLinger() |
long |
getMaxMsgSize() |
long |
getMulticastHops() |
long |
getRate() |
long |
getRcvHWM() |
long |
getReceiveBufferSize() |
int |
getReceiveTimeOut() |
long |
getReconnectIVL() |
long |
getReconnectIVLMax() |
long |
getRecoveryInterval() |
long |
getSendBufferSize() |
int |
getSendTimeOut() |
long |
getSndHWM() |
long |
getSwap()
Deprecated.
|
int |
getTCPKeepAlive() |
int |
getType()
The 'ZMQ_TYPE option shall retrieve the socket type for the specified
'socket'.
|
boolean |
hasMulticastLoop()
Deprecated.
|
boolean |
hasReceiveMore()
The 'ZMQ_RCVMORE' option shall return a boolean value indicating if the multi-part
message currently being read from the specified 'socket' has more message parts to
follow.
|
boolean |
monitor(String addr,
int events) |
byte[] |
recv()
Receive a message.
|
int |
recv(byte[] buffer,
int offset,
int len,
int flags)
Receive a message in to a specified buffer.
|
byte[] |
recv(int flags)
Receive a message.
|
int |
recvByteBuffer(ByteBuffer buffer,
int flags)
Receive a message into the specified ByteBuffer
|
String |
recvStr() |
String |
recvStr(int flags) |
boolean |
send(byte[] data) |
boolean |
send(byte[] data,
int flags) |
boolean |
send(String data) |
boolean |
send(String data,
int flags) |
boolean |
sendByteBuffer(ByteBuffer data,
int flags)
Send a message
|
boolean |
sendMore(byte[] data) |
boolean |
sendMore(String data) |
void |
setAffinity(long value)
Get the Affinity.
|
void |
setBacklog(long value) |
void |
setDecoder(Class<? extends DecoderBase> cls)
Set custom Decoder
|
void |
setEncoder(Class<? extends EncoderBase> cls)
Set custom Encoder
|
void |
setHWM(long hwm)
The 'ZMQ_HWM' option shall set the high water mark for the specified 'socket'.
|
void |
setIdentity(byte[] identity)
The 'ZMQ_IDENTITY' option shall set the identity of the specified 'socket'.
|
void |
setIPv4Only(boolean v4only)
The 'ZMQ_IPV4ONLY' option shall set the underlying native socket type.
|
void |
setLinger(long value)
The 'ZMQ_LINGER' option shall retrieve the period for pending outbound
messages to linger in memory after closing the socket.
|
void |
setMaxMsgSize(long value) |
void |
setMulticastHops(long value)
Sets the time-to-live field in every multicast packet sent from this socket.
|
void |
setMulticastLoop(boolean mcast_loop)
Deprecated.
|
void |
setRate(long value)
The 'ZMQ_RATE' option shall set the maximum send or receive data rate for multicast
transports such as in the man page of zmq_pgm[7] using the specified 'socket'.
|
void |
setRcvHWM(long value) |
void |
setReceiveBufferSize(long value)
The 'ZMQ_RCVBUF' option shall set the underlying kernel receive buffer size for the
'socket' to the specified size in bytes.
|
void |
setReceiveTimeOut(int value)
Sets the timeout for receive operation on the socket.
|
void |
setReconnectIVL(long value) |
void |
setReconnectIVLMax(long value) |
void |
setRecoveryInterval(long value)
The 'ZMQ_RECOVERY_IVL' option shall set the recovery interval for multicast transports
using the specified 'socket'.
|
void |
setRouterMandatory(boolean mandatory)
Sets the ROUTER socket behavior when an unroutable message is encountered.
|
void |
setSendBufferSize(long value)
The 'ZMQ_SNDBUF' option shall set the underlying kernel transmit buffer size for the
'socket' to the specified size in bytes.
|
void |
setSendTimeOut(int value)
Sets the timeout for send operation on the socket.
|
void |
setSndHWM(long value) |
void |
setSwap(long value)
Deprecated.
|
void |
setTCPKeepAlive(int optVal)
Override SO_KEEPALIVE socket option (where supported by OS) to enable keep-alive packets for a socket
connection.
|
void |
setXpubVerbose(boolean verbose)
Sets the XPUB socket behavior on new subscriptions and unsubscriptions.
|
void |
subscribe(byte[] topic)
The 'ZMQ_SUBSCRIBE' option shall establish a new message filter on a 'ZMQ_SUB' socket.
|
void |
unsubscribe(byte[] topic)
The 'ZMQ_UNSUBSCRIBE' option shall remove an existing message filter on a 'ZMQ_SUB'
socket.
|
protected ZMQ.Socket(ZMQ.Context context, int type)
context
- a 0MQ context previously created.type
- the socket type.protected ZMQ.Socket(SocketBase base_)
public SocketBase base()
public final void close()
public final int getType()
public final long getLinger()
setLinger(long)
public final void setLinger(long value)
value
- the linger period in milliseconds.public final long getReconnectIVL()
setReconnectIVL(long)
public final void setReconnectIVL(long value)
public final long getBacklog()
setBacklog(long)
public final void setBacklog(long value)
public final long getReconnectIVLMax()
setReconnectIVLMax(long)
public final void setReconnectIVLMax(long value)
public final long getMaxMsgSize()
setMaxMsgSize(long)
public final void setMaxMsgSize(long value)
public final long getSndHWM()
setSndHWM(long)
public final void setSndHWM(long value)
public final long getRcvHWM()
setRcvHWM(long)
public final void setRcvHWM(long value)
@Deprecated public final long getHWM()
setHWM(long)
public final void setHWM(long hwm)
hwm
- the number of messages to queue.@Deprecated public final long getSwap()
setSwap(long)
@Deprecated public final void setSwap(long value)
value
- The value of 'ZMQ_SWAP' defines the maximum size of the swap space in bytes.public final long getAffinity()
setAffinity(long)
public final void setAffinity(long value)
value
- the io_thread affinity.public final byte[] getIdentity()
setIdentity(byte[])
public final void setIdentity(byte[] identity)
identity
- public final long getRate()
setRate(long)
public final void setRate(long value)
value
- maximum send or receive data rate for multicast, default 100public final long getRecoveryInterval()
setRecoveryInterval(long)
public final void setRecoveryInterval(long value)
value
- recovery interval for multicast in milliseconds, default 10000@Deprecated public final boolean hasMulticastLoop()
setMulticastLoop(boolean)
@Deprecated public final void setMulticastLoop(boolean mcast_loop)
mcast_loop
- public final long getMulticastHops()
setMulticastHops(long)
public final void setMulticastHops(long value)
value
- time-to-live field in every multicast packet, default 1public final int getReceiveTimeOut()
setReceiveTimeOut(int)
public final void setReceiveTimeOut(int value)
value
- Timeout for receive operation in milliseconds. Default -1 (infinite)public final int getSendTimeOut()
setSendTimeOut(int)
public final void setSendTimeOut(int value)
value
- Timeout for send operation in milliseconds. Default -1 (infinite)public final long getSendBufferSize()
setSendBufferSize(long)
public final void setSendBufferSize(long value)
value
- underlying kernel transmit buffer size for the 'socket' in bytes
A value of zero means leave the OS default unchanged.public final long getReceiveBufferSize()
setReceiveBufferSize(long)
public final void setReceiveBufferSize(long value)
value
- Underlying kernel receive buffer size for the 'socket' in bytes.
A value of zero means leave the OS default unchanged.public final boolean hasReceiveMore()
public final SelectableChannel getFD()
public final int getEvents()
public final void subscribe(byte[] topic)
topic
- public final void unsubscribe(byte[] topic)
topic
- public final void setEncoder(Class<? extends EncoderBase> cls)
cls
- public final void setDecoder(Class<? extends DecoderBase> cls)
cls
- public final void setRouterMandatory(boolean mandatory)
mandatory
- A value of false is the default and discards the message silently when it cannot be routed.
A value of true returns an EHOSTUNREACH error code if the message cannot be routed.public final void setXpubVerbose(boolean verbose)
verbose
- A value of false is the default and passes only new subscription messages to upstream.
A value of true passes all subscription messages upstream.public final boolean getIPv4Only()
(boolean)
public void setIPv4Only(boolean v4only)
v4only
- A value of true will use IPv4 sockets, while the value of false will use IPv6 socketspublic int getTCPKeepAlive()
setTCPKeepAlive(int)
public void setTCPKeepAlive(int optVal)
optVal
- The value of 'ZMQ_TCP_KEEPALIVE' to turn TCP keepalives on (1) or off (0).public final int bind(String addr)
addr
- the endpoint to bind to.public int bindToRandomPort(String addr)
addr
- the endpoint to bind to.public int bindToRandomPort(String addr, int min, int max)
addr
- the endpoint to bind to.min
- The minimum port in the range of ports to try.max
- The maximum port in the range of ports to try.public final void connect(String addr)
addr
- the endpoint to connect to.public final boolean disconnect(String addr)
addr
- the endpoint to disconnect to.public final boolean send(String data)
public final boolean sendMore(String data)
public final boolean send(String data, int flags)
public final boolean send(byte[] data)
public final boolean sendMore(byte[] data)
public final boolean send(byte[] data, int flags)
public final boolean sendByteBuffer(ByteBuffer data, int flags)
data
- ByteBuffer payloadflags
- the flags to apply to the send operationpublic final byte[] recv()
public final byte[] recv(int flags)
flags
- the flags to apply to the receive operation.public final int recv(byte[] buffer, int offset, int len, int flags)
buffer
- byte[] to copy zmq message payload in to.offset
- offset in buffer to write datalen
- max bytes to write to buffer.
If len is smaller than the incoming message size,
the message will be truncated.flags
- the flags to apply to the receive operation.public final int recvByteBuffer(ByteBuffer buffer, int flags)
buffer
- the buffer to copy the zmq message payload intoflags
- the flags to apply to the receive operationpublic final String recvStr()
public final String recvStr(int flags)
flags
- the flags to apply to the receive operation.public boolean monitor(String addr, int events)
Copyright © 2013. All rights reserved.