{"id":13686918,"url":"https://github.com/alecthomas/gozmq","last_synced_at":"2026-01-11T03:48:16.004Z","repository":{"id":1097066,"uuid":"955996","full_name":"alecthomas/gozmq","owner":"alecthomas","description":"Go (golang) bindings for the 0mq (zmq, zeromq) C API","archived":true,"fork":false,"pushed_at":"2019-02-19T03:53:47.000Z","size":575,"stargazers_count":467,"open_issues_count":10,"forks_count":85,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-08-03T15:06:01.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecthomas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-02T04:59:52.000Z","updated_at":"2024-05-31T11:04:32.000Z","dependencies_parsed_at":"2022-07-15T20:30:41.158Z","dependency_job_id":null,"html_url":"https://github.com/alecthomas/gozmq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgozmq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgozmq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgozmq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgozmq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecthomas","download_url":"https://codeload.github.com/alecthomas/gozmq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224257278,"owners_count":17281677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T15:00:43.640Z","updated_at":"2026-01-11T03:48:15.932Z","avatar_url":"https://github.com/alecthomas.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# _NOTE:_ These gozmq bindings are in maintenance mode. Only critical bugs will be fixed. Henceforth I would suggest using [@pebbe's](https://github.com/pebbe) actively maintained bindings for [zmq2](https://github.com/pebbe/zmq2), [zmq3](https://github.com/pebbe/zmq3) and [zmq4](https://github.com/pebbe/zmq4).\n\n## Go (golang) Bindings for 0mq (zmq, zeromq)\n\n[![Build Status](https://travis-ci.org/alecthomas/gozmq.png)](https://travis-ci.org/alecthomas/gozmq)\n\nThis package implements [Go](http://golang.org) (golang) bindings for\nthe [0mq](http://zeromq.org) C API.\n\nGoZMQ [does not](#zero-copy) support zero-copy.\n\nA full list of examples is included in the [zguide](https://github.com/imatix/zguide/tree/master/examples/Go).\n\nNote that this is *not* the same as [this\nimplementation](http://github.com/boggle/gozero) or [this\nimplementation](http://code.google.com/p/gozmq/).\n\n## Upgrading\n\nGoZMQ has made some public changes that will break old code.  Fortunately, we've also written a tool based on `go fix` that will upgrade your code for you!  Here's how to run it over your source (after making a backup of course):\n\n    go get github.com/alecthomas/gozmq/gozmqfix\n    cd $YOUR_SOURCE_DIR\n    gozmqfix .\n\n## Installing\n\nGoZMQ currently supports ZMQ 2.1.x, 2.2.x, 3.x and 4.x. Following are instructions on how to compile against these versions.\n\nFor ZeroMQ 2.2.x install with:\n\n    go get github.com/alecthomas/gozmq\n\nFor 2.1.x install with:\n\n    go get -tags zmq_2_1 github.com/alecthomas/gozmq\n\nFor 3.x install with:\n\n    go get -tags zmq_3_x github.com/alecthomas/gozmq\n    \nFor 4.x install with:\n\n    go get -tags zmq_4_x github.com/alecthomas/gozmq\n\n### Troubleshooting\n\n#### Go can't find ZMQ\n\nIf the go tool can't find zmq and you know it is installed, you may need to override the C compiler/linker flags.\n\neg. If you installed zmq into `/opt/zmq` you might try:\n\n  CGO_CFLAGS=-I/opt/zmq/include CGO_LDFLAGS=-L/opt/zmq/lib \\\n    go get github.com/alecthomas/gozmq\n\n#### Mismatch in version of ZMQ\n\nIf you get errors like this with 'go get' or 'go build':\n\n    1: error: 'ZMQ_FOO' undeclared (first use in this function)\n\nThere are two possibilities:\n\n1. Your version of zmq is *very* old. In this case you will need to download and build zmq yourself.\n2. You are building gozmq against the wrong version of zmq. See the [installation](#installation) instructions for details on how to target the correct version.\n\n## Differences from the C API\n\nThe API implemented by this package does not attempt to expose\n`zmq_msg_t` at all. Instead, `Recv()` and `Send()` both operate on byte\nslices, allocating and freeing the memory automatically. Currently this\nrequires copying to/from C malloced memory, but a future implementation\nmay be able to avoid this to a certain extent.\n\nAll major features are supported: contexts, sockets, devices, and polls.\n\n## Example\n\nHere are direct translations of some of the examples from [this blog\npost](http://nichol.as/zeromq-an-introduction).\n\nA simple echo server:\n\n```go\npackage main\n\nimport zmq \"github.com/alecthomas/gozmq\"\n\nfunc main() {\n  context, _ := zmq.NewContext()\n  socket, _ := context.NewSocket(zmq.REP)\n  socket.Bind(\"tcp://127.0.0.1:5000\")\n  socket.Bind(\"tcp://127.0.0.1:6000\")\n\n  for {\n    msg, _ := socket.Recv(0)\n    println(\"Got\", string(msg))\n    socket.Send(msg, 0)\n  }\n}\n```\n\nA simple client for the above server:\n\n```go\npackage main\n\nimport \"fmt\"\nimport zmq \"github.com/alecthomas/gozmq\"\n\nfunc main() {\n  context, _ := zmq.NewContext()\n  socket, _ := context.NewSocket(zmq.REQ)\n  socket.Connect(\"tcp://127.0.0.1:5000\")\n  socket.Connect(\"tcp://127.0.0.1:6000\")\n\n  for i := 0; i \u003c 10; i++ {\n    msg := fmt.Sprintf(\"msg %d\", i)\n    socket.Send([]byte(msg), 0)\n    println(\"Sending\", msg)\n    socket.Recv(0)\n  }\n}\n```\n\n## Caveats\n\n### Zero-copy\n\nGoZMQ does not support zero-copy.\n\nGoZMQ does not attempt to expose `zmq_msg_t` at all. Instead, `Recv()` and `Send()`\nboth operate on byte slices, allocating and freeing the memory automatically.\nCurrently this requires copying to/from C malloced memory, but a future\nimplementation may be able to avoid this to a certain extent.\n\n\n### Memory management\n\nIt's not entirely clear from the 0mq documentation how memory for\n`zmq_msg_t` and packet data is managed once 0mq takes ownership. After\ndigging into the source a little, this package operates under the\nfollowing (educated) assumptions:\n\n-   References to `zmq_msg_t` structures are not held by the C API\n    beyond the duration of any function call.\n-   Packet data is reference counted internally by the C API. The count\n    is incremented when a packet is queued for delivery to a destination\n    (the inference being that for delivery to N destinations, the\n    reference count will be incremented N times) and decremented once\n    the packet has either been delivered or errored.\n\n## Usage\n\n```go\nconst (\n  // NewSocket types\n  PAIR   = SocketType(C.ZMQ_PAIR)\n  PUB    = SocketType(C.ZMQ_PUB)\n  SUB    = SocketType(C.ZMQ_SUB)\n  REQ    = SocketType(C.ZMQ_REQ)\n  REP    = SocketType(C.ZMQ_REP)\n  DEALER = SocketType(C.ZMQ_DEALER)\n  ROUTER = SocketType(C.ZMQ_ROUTER)\n  PULL   = SocketType(C.ZMQ_PULL)\n  PUSH   = SocketType(C.ZMQ_PUSH)\n  XPUB   = SocketType(C.ZMQ_XPUB)\n  XSUB   = SocketType(C.ZMQ_XSUB)\n\n  // Deprecated aliases\n  XREQ       = DEALER\n  XREP       = ROUTER\n  UPSTREAM   = PULL\n  DOWNSTREAM = PUSH\n\n  // NewSocket options\n  AFFINITY          = UInt64SocketOption(C.ZMQ_AFFINITY)\n  IDENTITY          = StringSocketOption(C.ZMQ_IDENTITY)\n  SUBSCRIBE         = StringSocketOption(C.ZMQ_SUBSCRIBE)\n  UNSUBSCRIBE       = StringSocketOption(C.ZMQ_UNSUBSCRIBE)\n  RATE              = Int64SocketOption(C.ZMQ_RATE)\n  RECOVERY_IVL      = Int64SocketOption(C.ZMQ_RECOVERY_IVL)\n  SNDBUF            = UInt64SocketOption(C.ZMQ_SNDBUF)\n  RCVBUF            = UInt64SocketOption(C.ZMQ_RCVBUF)\n  FD                = Int64SocketOption(C.ZMQ_FD)\n  EVENTS            = UInt64SocketOption(C.ZMQ_EVENTS)\n  TYPE              = UInt64SocketOption(C.ZMQ_TYPE)\n  LINGER            = IntSocketOption(C.ZMQ_LINGER)\n  RECONNECT_IVL     = IntSocketOption(C.ZMQ_RECONNECT_IVL)\n  RECONNECT_IVL_MAX = IntSocketOption(C.ZMQ_RECONNECT_IVL_MAX)\n  BACKLOG           = IntSocketOption(C.ZMQ_BACKLOG)\n\n  // Send/recv options\n  SNDMORE = SendRecvOption(C.ZMQ_SNDMORE)\n)\n```\n\n```go\nconst (\n  POLLIN  = PollEvents(C.ZMQ_POLLIN)\n  POLLOUT = PollEvents(C.ZMQ_POLLOUT)\n  POLLERR = PollEvents(C.ZMQ_POLLERR)\n)\n```\n\n```go\nconst (\n  STREAMER  = DeviceType(C.ZMQ_STREAMER)\n  FORWARDER = DeviceType(C.ZMQ_FORWARDER)\n  QUEUE     = DeviceType(C.ZMQ_QUEUE)\n)\n```\n\n```go\nconst (\n  RCVTIMEO = IntSocketOption(C.ZMQ_RCVTIMEO)\n  SNDTIMEO = IntSocketOption(C.ZMQ_SNDTIMEO)\n)\n```\n\n```go\nconst (\n  RCVMORE           = UInt64SocketOption(C.ZMQ_RCVMORE)\n  RECOVERY_IVL_MSEC = Int64SocketOption(C.ZMQ_RECOVERY_IVL_MSEC)\n  SWAP              = Int64SocketOption(C.ZMQ_SWAP)\n  MCAST_LOOP        = Int64SocketOption(C.ZMQ_MCAST_LOOP)\n  HWM               = UInt64SocketOption(C.ZMQ_HWM)\n  NOBLOCK           = SendRecvOption(C.ZMQ_NOBLOCK)\n\n  // Forwards-compatible aliases:\n  DONTWAIT = NOBLOCK\n)\n```\n\n```go\nconst (\n  RCVMORE = IntSocketOption(C.ZMQ_RCVMORE)\n  SNDHWM  = IntSocketOption(C.ZMQ_SNDHWM)\n  RCVHWM  = IntSocketOption(C.ZMQ_RCVHWM)\n\n  // TODO Not documented in the man page...\n  //LAST_ENDPOINT       = UInt64SocketOption(C.ZMQ_LAST_ENDPOINT)\n  FAIL_UNROUTABLE     = BoolSocketOption(C.ZMQ_FAIL_UNROUTABLE)\n  TCP_KEEPALIVE       = IntSocketOption(C.ZMQ_TCP_KEEPALIVE)\n  TCP_KEEPALIVE_CNT   = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_CNT)\n  TCP_KEEPALIVE_IDLE  = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_IDLE)\n  TCP_KEEPALIVE_INTVL = IntSocketOption(C.ZMQ_TCP_KEEPALIVE_INTVL)\n  TCP_ACCEPT_FILTER   = StringSocketOption(C.ZMQ_TCP_ACCEPT_FILTER)\n\n  // Message options\n  MORE = MessageOption(C.ZMQ_MORE)\n\n  // Send/recv options\n  DONTWAIT = SendRecvOption(C.ZMQ_DONTWAIT)\n\n  // Deprecated aliases\n  NOBLOCK = DONTWAIT\n)\n```\n\n```go\nvar (\n  // Additional ZMQ errors\n  ENOTSOCK       error = zmqErrno(C.ENOTSOCK)\n  EFSM           error = zmqErrno(C.EFSM)\n  EINVAL         error = zmqErrno(C.EINVAL)\n  ENOCOMPATPROTO error = zmqErrno(C.ENOCOMPATPROTO)\n  ETERM          error = zmqErrno(C.ETERM)\n  EMTHREAD       error = zmqErrno(C.EMTHREAD)\n)\n```\n\n#### func  Device\n\n```go\nfunc Device(t DeviceType, in, out *Socket) error\n```\nrun a zmq_device passing messages between in and out\n\n#### func  Poll\n\n```go\nfunc Poll(items []PollItem, timeout time.Duration) (count int, err error)\n```\nPoll ZmqSockets and file descriptors for I/O readiness. Timeout is in\ntime.Duration. The smallest possible timeout is time.Millisecond for ZeroMQ\nversion 3 and above, and time.Microsecond for earlier versions.\n\n#### func  Proxy\n\n```go\nfunc Proxy(in, out, capture *Socket) error\n```\nrun a zmq_proxy with in, out and capture sockets\n\n#### func  Version\n\n```go\nfunc Version() (int, int, int)\n```\nvoid zmq_version (int *major, int *minor, int *patch);\n\n#### type BoolSocketOption\n\n```go\ntype BoolSocketOption int\n```\n\n\n#### type Context\n\n```go\ntype Context struct {\n}\n```\n\n* A context handles socket creation and asynchronous message delivery. * There\nshould generally be one context per application.\n\n#### func  NewContext\n\n```go\nfunc NewContext() (*Context, error)\n```\nCreate a new context.\n\n#### func (*Context) Close\n\n```go\nfunc (c *Context) Close()\n```\n\n#### func (*Context) IOThreads\n\n```go\nfunc (c *Context) IOThreads() (int, error)\n```\nGet a context option.\n\n#### func (*Context) MaxSockets\n\n```go\nfunc (c *Context) MaxSockets() (int, error)\n```\n\n#### func (*Context) NewSocket\n\n```go\nfunc (c *Context) NewSocket(t SocketType) (*Socket, error)\n```\nCreate a new socket. void *zmq_socket (void *context, int type);\n\n#### func (*Context) SetIOThreads\n\n```go\nfunc (c *Context) SetIOThreads(value int) error\n```\nSet a context option.\n\n#### func (*Context) SetMaxSockets\n\n```go\nfunc (c *Context) SetMaxSockets(value int) error\n```\n\n#### type DeviceType\n\n```go\ntype DeviceType int\n```\n\n\n#### type Int64SocketOption\n\n```go\ntype Int64SocketOption int\n```\n\n\n#### type IntSocketOption\n\n```go\ntype IntSocketOption int\n```\n\n\n#### type MessageOption\n\n```go\ntype MessageOption int\n```\n\n\n#### type PollEvents\n\n```go\ntype PollEvents C.short\n```\n\n\n#### type PollItem\n\n```go\ntype PollItem struct {\n  Socket  *Socket         // socket to poll for events on\n  Fd      ZmqOsSocketType // fd to poll for events on as returned from os.File.Fd()\n  Events  PollEvents      // event set to poll for\n  REvents PollEvents      // events that were present\n}\n```\n\nItem to poll for read/write events on, either a *Socket or a file descriptor\n\n#### type PollItems\n\n```go\ntype PollItems []PollItem\n```\n\na set of items to poll for events on\n\n#### type SendRecvOption\n\n```go\ntype SendRecvOption int\n```\n\n\n#### type Socket\n\n```go\ntype Socket struct {\n}\n```\n\n\n#### func (*Socket) Affinity\n\n```go\nfunc (s *Socket) Affinity() (uint64, error)\n```\nZMQ_AFFINITY: Retrieve I/O thread affinity.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc7\n\n#### func (*Socket) Backlog\n\n```go\nfunc (s *Socket) Backlog() (int, error)\n```\nZMQ_BACKLOG: Retrieve maximum length of the queue of outstanding connections.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc18\n\n#### func (*Socket) Bind\n\n```go\nfunc (s *Socket) Bind(address string) error\n```\nBind the socket to a listening address. int zmq_bind (void *s, const char\n*addr);\n\n#### func (*Socket) Close\n\n```go\nfunc (s *Socket) Close() error\n```\nShutdown the socket. int zmq_close (void *s);\n\n#### func (*Socket) Connect\n\n```go\nfunc (s *Socket) Connect(address string) error\n```\nConnect the socket to an address. int zmq_connect (void *s, const char *addr);\n\n#### func (*Socket) Events\n\n```go\nfunc (s *Socket) Events() (uint64, error)\n```\nZMQ_EVENTS: Retrieve socket event state.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc20\n\n#### func (*Socket) GetSockOptBool\n\n```go\nfunc (s *Socket) GetSockOptBool(option BoolSocketOption) (value bool, err error)\n```\n\n#### func (*Socket) GetSockOptInt\n\n```go\nfunc (s *Socket) GetSockOptInt(option IntSocketOption) (value int, err error)\n```\nGet an int option from the socket. int zmq_getsockopt (void *s, int option, void\n*optval, size_t *optvallen);\n\n#### func (*Socket) GetSockOptInt64\n\n```go\nfunc (s *Socket) GetSockOptInt64(option Int64SocketOption) (value int64, err error)\n```\nGet an int64 option from the socket. int zmq_getsockopt (void *s, int option,\nvoid *optval, size_t *optvallen);\n\n#### func (*Socket) GetSockOptString\n\n```go\nfunc (s *Socket) GetSockOptString(option StringSocketOption) (value string, err error)\n```\nGet a string option from the socket. int zmq_getsockopt (void *s, int option,\nvoid *optval, size_t *optvallen);\n\n#### func (*Socket) GetSockOptUInt64\n\n```go\nfunc (s *Socket) GetSockOptUInt64(option UInt64SocketOption) (value uint64, err error)\n```\nGet a uint64 option from the socket. int zmq_getsockopt (void *s, int option,\nvoid *optval, size_t *optvallen);\n\n#### func (*Socket) HWM\n\n```go\nfunc (s *Socket) HWM() (uint64, error)\n```\nZMQ_HWM: Retrieve high water mark.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc5\n\n#### func (*Socket) Identity\n\n```go\nfunc (s *Socket) Identity() (string, error)\n```\nZMQ_IDENTITY: Retrieve socket identity.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc8\n\n#### func (*Socket) Linger\n\n```go\nfunc (s *Socket) Linger() (time.Duration, error)\n```\nZMQ_LINGER: Retrieve linger period for socket shutdown.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc15\n\n#### func (*Socket) McastLoop\n\n```go\nfunc (s *Socket) McastLoop() (bool, error)\n```\nZMQ_MCAST_LOOP: Control multicast loop-back.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc12\n\n#### func (*Socket) Rate\n\n```go\nfunc (s *Socket) Rate() (int64, error)\n```\nZMQ_RATE: Retrieve multicast data rate.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc9\n\n#### func (*Socket) RcvBuf\n\n```go\nfunc (s *Socket) RcvBuf() (uint64, error)\n```\nZMQ_RCVBUF: Retrieve kernel receive buffer size.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc14\n\n#### func (*Socket) RcvHWM\n\n```go\nfunc (s *Socket) RcvHWM() (int, error)\n```\nZMQ_RCVHWM: Retrieve high water mark for inbound messages.\n\nSee: http://api.zeromq.org/3.2:zmq-getsockopt#toc6\n\n#### func (*Socket) RcvMore\n\n```go\nfunc (s *Socket) RcvMore() (bool, error)\n```\nZMQ_RCVMORE: More message parts to follow.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc4\n\n#### func (*Socket) RcvTimeout\n\n```go\nfunc (s *Socket) RcvTimeout() (time.Duration, error)\n```\nZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN.\n\nSee: http://api.zeromq.org/2.2:zmq-getsockopt#toc6\n\n#### func (*Socket) ReconnectIvl\n\n```go\nfunc (s *Socket) ReconnectIvl() (time.Duration, error)\n```\nZMQ_RECONNECT_IVL: Retrieve reconnection interval.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc16\n\n#### func (*Socket) ReconnectIvlMax\n\n```go\nfunc (s *Socket) ReconnectIvlMax() (time.Duration, error)\n```\nZMQ_RECONNECT_IVL_MAX: Retrieve maximum reconnection interval.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc17\n\n#### func (*Socket) RecoveryIvl\n\n```go\nfunc (s *Socket) RecoveryIvl() (time.Duration, error)\n```\nZMQ_RECOVERY_IVL_MSEC: Get multicast recovery interval in milliseconds.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc11\n\n#### func (*Socket) Recv\n\n```go\nfunc (s *Socket) Recv(flags SendRecvOption) (data []byte, err error)\n```\nReceive a message from the socket. int zmq_recv (void *s, zmq_msg_t *msg, int\nflags);\n\n#### func (*Socket) RecvMultipart\n\n```go\nfunc (s *Socket) RecvMultipart(flags SendRecvOption) (parts [][]byte, err error)\n```\nReceive a multipart message.\n\n#### func (*Socket) Send\n\n```go\nfunc (s *Socket) Send(data []byte, flags SendRecvOption) error\n```\nSend a message to the socket. int zmq_send (void *s, zmq_msg_t *msg, int flags);\n\n#### func (*Socket) SendMultipart\n\n```go\nfunc (s *Socket) SendMultipart(parts [][]byte, flags SendRecvOption) (err error)\n```\nSend a multipart message.\n\n#### func (*Socket) SetAffinity\n\n```go\nfunc (s *Socket) SetAffinity(value uint64) error\n```\nZMQ_AFFINITY: Set I/O thread affinity.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc5\n\n#### func (*Socket) SetBacklog\n\n```go\nfunc (s *Socket) SetBacklog(value int) error\n```\nZMQ_BACKLOG: Set maximum length of the queue of outstanding connections.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc18\n\n#### func (*Socket) SetHWM\n\n```go\nfunc (s *Socket) SetHWM(value uint64) error\n```\nZMQ_HWM: Set high water mark.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc3\n\n#### func (*Socket) SetIdentity\n\n```go\nfunc (s *Socket) SetIdentity(value string) error\n```\nZMQ_IDENTITY: Set socket identity.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc6\n\n#### func (*Socket) SetLinger\n\n```go\nfunc (s *Socket) SetLinger(value time.Duration) error\n```\nZMQ_LINGER: Set linger period for socket shutdown.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc15\n\n#### func (*Socket) SetMcastLoop\n\n```go\nfunc (s *Socket) SetMcastLoop(value bool) error\n```\nZMQ_MCAST_LOOP: Control multicast loop-back.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc12\n\n#### func (*Socket) SetRate\n\n```go\nfunc (s *Socket) SetRate(value int64) error\n```\nZMQ_RATE: Set multicast data rate.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc9\n\n#### func (*Socket) SetRcvBuf\n\n```go\nfunc (s *Socket) SetRcvBuf(value uint64) error\n```\nZMQ_RCVBUF: Set kernel receive buffer size.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc14\n\n#### func (*Socket) SetRcvHWM\n\n```go\nfunc (s *Socket) SetRcvHWM(value int) error\n```\nZMQ_RCVHWM: Set high water mark for inbound messages.\n\nSee: http://api.zeromq.org/3.2:zmq-setsockopt#toc4\n\n#### func (*Socket) SetRcvTimeout\n\n```go\nfunc (s *Socket) SetRcvTimeout(value time.Duration) error\n```\nZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN.\n\nSee: http://api.zeromq.org/2.2:zmq-setsockopt#toc9\n\n#### func (*Socket) SetReconnectIvl\n\n```go\nfunc (s *Socket) SetReconnectIvl(value time.Duration) error\n```\nZMQ_RECONNECT_IVL: Set reconnection interval.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc16\n\n#### func (*Socket) SetReconnectIvlMax\n\n```go\nfunc (s *Socket) SetReconnectIvlMax(value time.Duration) error\n```\nZMQ_RECONNECT_IVL_MAX: Set maximum reconnection interval.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc17\n\n#### func (*Socket) SetRecoveryIvl\n\n```go\nfunc (s *Socket) SetRecoveryIvl(value time.Duration) error\n```\nZMQ_RECOVERY_IVL_MSEC: Set multicast recovery interval in milliseconds.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc11\n\n#### func (*Socket) SetSndBuf\n\n```go\nfunc (s *Socket) SetSndBuf(value uint64) error\n```\nZMQ_SNDBUF: Set kernel transmit buffer size.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc13\n\n#### func (*Socket) SetSndHWM\n\n```go\nfunc (s *Socket) SetSndHWM(value int) error\n```\nZMQ_SNDHWM: Set high water mark for outbound messages.\n\nSee: http://api.zeromq.org/3.2:zmq-setsockopt#toc3\n\n#### func (*Socket) SetSndTimeout\n\n```go\nfunc (s *Socket) SetSndTimeout(value time.Duration) error\n```\nZMQ_SNDTIMEO: Maximum time before a send operation returns with EAGAIN.\n\nSee: http://api.zeromq.org/2.2:zmq-setsockopt#toc10\n\n#### func (*Socket) SetSockOptInt\n\n```go\nfunc (s *Socket) SetSockOptInt(option IntSocketOption, value int) error\n```\nSet an int option on the socket. int zmq_setsockopt (void *s, int option, const\nvoid *optval, size_t optvallen);\n\n#### func (*Socket) SetSockOptInt64\n\n```go\nfunc (s *Socket) SetSockOptInt64(option Int64SocketOption, value int64) error\n```\nSet an int64 option on the socket. int zmq_setsockopt (void *s, int option,\nconst void *optval, size_t optvallen);\n\n#### func (*Socket) SetSockOptString\n\n```go\nfunc (s *Socket) SetSockOptString(option StringSocketOption, value string) error\n```\nSet a string option on the socket. int zmq_setsockopt (void *s, int option,\nconst void *optval, size_t optvallen);\n\n#### func (*Socket) SetSockOptStringNil\n\n```go\nfunc (s *Socket) SetSockOptStringNil(option StringSocketOption) error\n```\nSet a string option on the socket to nil. int zmq_setsockopt (void *s, int\noption, const void *optval, size_t optvallen);\n\n#### func (*Socket) SetSockOptUInt64\n\n```go\nfunc (s *Socket) SetSockOptUInt64(option UInt64SocketOption, value uint64) error\n```\nSet a uint64 option on the socket. int zmq_setsockopt (void *s, int option,\nconst void *optval, size_t optvallen);\n\n#### func (*Socket) SetSubscribe\n\n```go\nfunc (s *Socket) SetSubscribe(value string) error\n```\nZMQ_SUBSCRIBE: Establish message filter.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc7\n\n#### func (*Socket) SetSwap\n\n```go\nfunc (s *Socket) SetSwap(value int64) error\n```\nZMQ_SWAP: Set disk offload size.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc4\n\n#### func (*Socket) SetTCPKeepalive\n\n```go\nfunc (s *Socket) SetTCPKeepalive(value int) error\n```\nZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option.\n\nSee: http://api.zeromq.org/3.2:zmq-setsockopt#toc25\n\n#### func (*Socket) SetTCPKeepaliveCnt\n\n```go\nfunc (s *Socket) SetTCPKeepaliveCnt(value int) error\n```\nZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option.\n\nSee: http://api.zeromq.org/3.2:zmq-setsockopt#toc27\n\n#### func (*Socket) SetTCPKeepaliveIdle\n\n```go\nfunc (s *Socket) SetTCPKeepaliveIdle(value int) error\n```\nZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS).\n\nSee: http://api.zeromq.org/3.2:zmq-setsockopt#toc26\n\n#### func (*Socket) SetTCPKeepaliveIntvl\n\n```go\nfunc (s *Socket) SetTCPKeepaliveIntvl(value int) error\n```\nZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option.\n\nSee: http://api.zeromq.org/3.2:zmq-setsockopt#toc28\n\n#### func (*Socket) SetUnsubscribe\n\n```go\nfunc (s *Socket) SetUnsubscribe(value string) error\n```\nZMQ_UNSUBSCRIBE: Remove message filter.\n\nSee: http://api.zeromq.org/2.1:zmq-setsockopt#toc8\n\n#### func (*Socket) SndBuf\n\n```go\nfunc (s *Socket) SndBuf() (uint64, error)\n```\nZMQ_SNDBUF: Retrieve kernel transmit buffer size.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc13\n\n#### func (*Socket) SndHWM\n\n```go\nfunc (s *Socket) SndHWM() (int, error)\n```\nZMQ_SNDHWM: Retrieves high water mark for outbound messages.\n\nSee: http://api.zeromq.org/3.2:zmq-getsockopt#toc5\n\n#### func (*Socket) SndTimeout\n\n```go\nfunc (s *Socket) SndTimeout() (time.Duration, error)\n```\nZMQ_SNDTIMEO: Maximum time before a socket operation returns with EAGAIN.\n\nSee: http://api.zeromq.org/2.2:zmq-getsockopt#toc7\n\n#### func (*Socket) Swap\n\n```go\nfunc (s *Socket) Swap() (int64, error)\n```\nZMQ_SWAP: Retrieve disk offload size.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc6\n\n#### func (*Socket) TCPKeepalive\n\n```go\nfunc (s *Socket) TCPKeepalive() (int, error)\n```\nZMQ_TCP_KEEPALIVE: Override SO_KEEPALIVE socket option.\n\nSee: http://api.zeromq.org/3.2:zmq-getsockopt#toc26\n\n#### func (*Socket) TCPKeepaliveCnt\n\n```go\nfunc (s *Socket) TCPKeepaliveCnt() (int, error)\n```\nZMQ_TCP_KEEPALIVE_CNT: Override TCP_KEEPCNT socket option.\n\nSee: http://api.zeromq.org/3.2:zmq-getsockopt#toc28\n\n#### func (*Socket) TCPKeepaliveIdle\n\n```go\nfunc (s *Socket) TCPKeepaliveIdle() (int, error)\n```\nZMQ_TCP_KEEPALIVE_IDLE: Override TCP_KEEPCNT(or TCP_KEEPALIVE on some OS).\n\nSee: http://api.zeromq.org/3.2:zmq-getsockopt#toc27\n\n#### func (*Socket) TCPKeepaliveIntvl\n\n```go\nfunc (s *Socket) TCPKeepaliveIntvl() (int, error)\n```\nZMQ_TCP_KEEPALIVE_INTVL: Override TCP_KEEPINTVL socket option.\n\nSee: http://api.zeromq.org/3.2:zmq-getsockopt#toc29\n\n#### func (*Socket) Type\n\n```go\nfunc (s *Socket) Type() (SocketType, error)\n```\nZMQ_TYPE: Retrieve socket type.\n\nSee: http://api.zeromq.org/2.1:zmq-getsockopt#toc3\n\n#### type SocketType\n\n```go\ntype SocketType int\n```\n\n\n#### type StringSocketOption\n\n```go\ntype StringSocketOption int\n```\n\n\n#### type UInt64SocketOption\n\n```go\ntype UInt64SocketOption int\n```\n\n\n#### type ZmqOsSocketType\n\n```go\ntype ZmqOsSocketType C.SOCKET\n```\n\n\n#### func (ZmqOsSocketType) ToRaw\n\n```go\nfunc (self ZmqOsSocketType) ToRaw() C.SOCKET\n```\n\n*(generated from .[godocdown](https://github.com/robertkrimen/godocdown).md with `godocdown github.com/alecthomas/gozmq \u003e README.md`)*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fgozmq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecthomas%2Fgozmq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fgozmq/lists"}