Skip to content
This repository
Browse code

Merge pull request #89 from tchap/socket-disconnect

Implement zmq_disconnect
  • Loading branch information...
commit 62f3d9826d867e3b77c27a3ff63ba26a293ba18e 2 parents f2e0536 + a973a3c
Alec Thomas authored September 12, 2013

Showing 1 changed file with 14 additions and 0 deletions. Show diff stats Hide diff stats

  1. 14  zmq_3_x.go
14  zmq_3_x.go
@@ -129,6 +129,20 @@ func (s *Socket) SetHWM(value int) error {
129 129
 	return rcv
130 130
 }
131 131
 
  132
+// Disconnect the socket from the address.
  133
+// int zmq_disconnect (void *s, const char *addr);
  134
+func (s *Socket) Disconnect(address string) error {
  135
+	if s.c == nil {
  136
+		return ENOTSOCK
  137
+	}
  138
+	a := C.CString(address)
  139
+	defer C.free(unsafe.Pointer(a))
  140
+	if rc, err := C.zmq_disconnect(s.s, a); rc != 0 {
  141
+		return casterr(err)
  142
+	}
  143
+	return nil
  144
+}
  145
+
132 146
 // Send a message to the socket.
133 147
 // int zmq_send (void *s, zmq_msg_t *msg, int flags);
134 148
 func (s *Socket) Send(data []byte, flags SendRecvOption) error {

0 notes on commit 62f3d98

Please sign in to comment.
Something went wrong with that request. Please try again.