File tree Expand file tree Collapse file tree
Source/Processors/NetworkEvents Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from __future__ import print_function , unicode_literals
2+
3+ import zmq
4+
5+ try :
6+ raw_input
7+ except NameError :
8+ # Python 3
9+ raw_input = input
10+
11+
12+ def run (hostname = 'localhost' , port = 5556 ):
13+ with zmq .Context () as ctx :
14+ with ctx .socket (zmq .REQ ) as sock :
15+ sock .connect ('tcp://%s:%d' % (hostname , port ))
16+ while True :
17+ try :
18+ req = raw_input ('> ' )
19+ sock .send_string (req )
20+ rep = sock .recv_string ()
21+ print (rep )
22+ except EOFError :
23+ print () # Add final newline
24+ break
25+
26+
27+ if __name__ == '__main__' :
28+ run ()
Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ void NetworkEvents::run()
449449 if (rc != 0 )
450450 {
451451 // failed to open socket?
452- std::cout << " Failed to open socket. " << std::endl;
452+ std::cout << " Failed to open socket: " << zmq_strerror ( zmq_errno ()) << std::endl;
453453 return ;
454454 }
455455
@@ -562,7 +562,7 @@ void NetworkEvents::loadCustomParametersFromXml()
562562void NetworkEvents::createZmqContext ()
563563{
564564#ifdef ZEROMQ
565- if (zmqcontext ! = nullptr )
565+ if (zmqcontext = = nullptr )
566566 zmqcontext = zmq_ctx_new (); // <-- this is only available in version 3+
567567#endif
568568}
You can’t perform that action at this time.
0 commit comments