libzmq master
The Intelligent Transport Layer

test_reqrep_inproc.cpp

Go to the documentation of this file.
00001 /*
00002     Copyright (c) 2010-2011 250bpm s.r.o.
00003     Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
00004 
00005     This file is part of 0MQ.
00006 
00007     0MQ is free software; you can redistribute it and/or modify it under
00008     the terms of the GNU Lesser General Public License as published by
00009     the Free Software Foundation; either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     0MQ is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #include <assert.h>
00022 #include <stdio.h>
00023 #include "testutil.hpp"
00024 
00025 int main (int argc, char *argv [])
00026 {
00027     fprintf (stderr, "test_reqrep_inproc running...\n");
00028 
00029     void *ctx = zmq_init (0);
00030     assert (ctx);
00031 
00032     void *sb = zmq_socket (ctx, ZMQ_REP);
00033     assert (sb);
00034     int rc = zmq_bind (sb, "inproc://a");
00035     assert (rc == 0);
00036 
00037     void *sc = zmq_socket (ctx, ZMQ_REQ);
00038     assert (sc);
00039     rc = zmq_connect (sc, "inproc://a");
00040     assert (rc == 0);
00041     
00042     bounce (sb, sc);
00043 
00044     rc = zmq_close (sc);
00045     assert (rc == 0);
00046 
00047     rc = zmq_close (sb);
00048     assert (rc == 0);
00049 
00050     rc = zmq_term (ctx);
00051     assert (rc == 0);
00052 
00053     return 0 ;
00054 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines