libzmq  master
ZeroMQ C++ Core Engine (LIBZMQ)
test_unbind_inproc.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
3 
4  This file is part of 0MQ.
5 
6  0MQ is free software; you can redistribute it and/or modify it under
7  the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation; either version 3 of the License, or
9  (at your option) any later version.
10 
11  0MQ is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "testutil.hpp"
21 
22 int main (void)
23 {
25  void *ctx = zmq_ctx_new ();
26  assert (ctx);
27 
28  void *sb = zmq_socket (ctx, ZMQ_REP);
29  assert (sb);
30  int rc = zmq_bind (sb, "inproc://a");
31  assert (rc == 0);
32 
33  rc = zmq_unbind (sb, "inproc://a");
34  assert (rc == 0);
35 
36  rc = zmq_close (sb);
37  assert (rc == 0);
38 
39  rc = zmq_ctx_term (ctx);
40  assert (rc == 0);
41 
42  return 0;
43 }
ZMQ_EXPORT int zmq_unbind(void *s, const char *addr)
Definition: zmq.cpp:343
ZMQ_EXPORT void * zmq_ctx_new(void)
Definition: zmq.cpp:115
#define ZMQ_REP
Definition: zmq.h:250
void setup_test_environment(void)
Definition: testutil.hpp:285
ZMQ_EXPORT void * zmq_socket(void *, int type)
Definition: zmq.cpp:244
ZMQ_EXPORT int zmq_close(void *s)
Definition: zmq.cpp:255
int main(void)
ZMQ_EXPORT int zmq_bind(void *s, const char *addr)
Definition: zmq.cpp:321
ZMQ_EXPORT int zmq_ctx_term(void *context)
Definition: zmq.cpp:162