libzmq master
The Intelligent Transport Layer

test_pair_tcp.cpp

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