'\" t .\" Title: zmq_udp .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 10/23/2023 .\" Manual: 0MQ Manual .\" Source: 0MQ 4.3.5 .\" Language: English .\" .TH "ZMQ_UDP" "7" "10/23/2023" "0MQ 4\&.3\&.5" "0MQ Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" zmq_udp \- 0MQ UDP multicast and unicast transport .SH "SYNOPSIS" .sp UDP is unreliable protocol transport of data over IP networks\&. UDP support both unicast and multicast communication\&. .SH "DESCRIPTION" .sp UDP transport can only be used with the \fIZMQ_RADIO\fR and \fIZMQ_DISH\fR socket types\&. .SH "ADDRESSING" .sp A 0MQ endpoint is a string consisting of a \fItransport\fR:// followed by an \fIaddress\fR\&. The \fItransport\fR specifies the underlying protocol to use\&. The \fIaddress\fR specifies the transport\-specific address to connect to\&. .sp For the UDP transport, the transport is udp\&. The meaning of the \fIaddress\fR part is defined below\&. .SH "BINDING A SOCKET" .sp With \fIudp\fR we can only bind the \fIZMQ_DISH\fR socket type\&. When binding a socket using \fIzmq_bind()\fR with the \fIudp\fR transport the \fIendpoint\fR shall be interpreted as an \fIinterface\fR followed by a colon and the UDP port number to use\&. .sp An \fIinterface\fR may be specified by either of the following: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The wild\-card *, meaning all available interfaces\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The name of the network interface (i\&.e\&. eth0, lo, wlan0 etc\&...) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The primary address assigned to the interface, in its numeric representation\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Multicast address in its numeric representation the socket should join\&. .RE .sp The UDP port number may be specified a numeric value, usually above 1024 on POSIX systems\&. .SH "CONNECTING A SOCKET" .sp With \fIudp\fR we can only connect the \fIZMQ_RADIO\fR socket type\&. When connecting a socket to a peer address using \fIzmq_connect()\fR with the \fIudp\fR transport, the \fIendpoint\fR shall be interpreted as a \fIpeer address\fR followed by a colon and the UDP port number to use\&. .sp A \fIpeer address\fR may be specified by either of the following: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} The IPv4 or IPv6 address of the peer, in its numeric representation or using its hostname\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Multicast address in its numeric representation\&. .RE .SH "EXAMPLES" .PP \fBBinding a socket\fR. .sp .if n \{\ .RS 4 .\} .nf // Unicast \- UDP port 5555 on all available interfaces rc = zmq_bind(dish, "udp://*:5555"); assert (rc == 0); // Unicast \- UDP port 5555 on the local loop\-back interface rc = zmq_bind(dish, "udp://127\&.0\&.0\&.1:5555"); assert (rc == 0); // Unicast \- UDP port 5555 on interface eth1 rc = zmq_bind(dish, "udp://eth1:5555"); assert (rc == 0); // Multicast \- UDP port 5555 on a Multicast address rc = zmq_bind(dish, "udp://239\&.0\&.0\&.1:5555"); assert (rc == 0); // Same as above but joining only on interface eth0 rc = zmq_bind(dish, "udp://eth0;239\&.0\&.0\&.1:5555"); assert (rc == 0); // Same as above using IPv6 multicast rc = zmq_bind(dish, "udp://eth0;[ff02::1]:5555"); assert (rc == 0); .fi .if n \{\ .RE .\} .PP \fBConnecting a socket\fR. .sp .if n \{\ .RS 4 .\} .nf // Connecting using an Unicast IP address rc = zmq_connect(radio, "udp://192\&.168\&.1\&.1:5555"); assert (rc == 0); // Connecting using a Multicast address rc = zmq_connect(socket, "udp://239\&.0\&.0\&.1:5555); assert (rc == 0); // Connecting using a Multicast address using local interface wlan0 rc = zmq_connect(socket, "udp://wlan0;239\&.0\&.0\&.1:5555); assert (rc == 0); // Connecting to IPv6 multicast rc = zmq_connect(socket, "udp://[ff02::1]:5555); assert (rc == 0); .fi .if n \{\ .RE .\} .sp .SH "SEE ALSO" .sp \fBzmq_connect\fR(3) \fBzmq_setsockopt\fR(3) \fBzmq_tcp\fR(7) \fBzmq_ipc\fR(7) \fBzmq_inproc\fR(7) \fBzmq_vmci\fR(7) \fBzmq\fR(7) .SH "AUTHORS" .sp This page was written by the 0MQ community\&. To make a change please read the 0MQ Contribution Policy at \m[blue]\fBhttp://www\&.zeromq\&.org/docs:contributing\fR\m[]\&.