Bug #1042

Socket communcation does not work between C++ and Python on MacOS

Added by S. Wrede over 9 years ago. Updated over 9 years ago.

Status:ResolvedStart date:06/28/2012
Priority:HighDue date:
Assignee:J. Moringen% Done:

100%

Category:Python
Target version:rsb-0.7

Description

Environment is as follows:

  1. rsb-python informer started (fresh easy_install 28th of June)
    In [1]: import logging
    
    In [2]: logging.basicConfig(level=logging.DEBUG)
    
    In [3]: from rsb import createInformer, Scope
    
    In [4]: i = createInformer(Scope("/example/informer"),dataType=str)
    DEBUG:rsb.transport.socket.OutConnector:Using specified converter map for wire-type <type 'bytearray'>
    INFO:rsb.eventprocessing.OutRouteConfigurator:Activating configurator
    INFO:rsb.Informer:Activated informer
    
  2. rsb-cpp rsb_listener started
    ip-129-70-135-195:~ swrede$ rsb_listener 
    Listener setup finished. Waiting for messages on scope Scope[/example/informer/]
    
  3. Publish information from Python
    In [5]: i.publishData("sdadsfasdf")
    DEBUG:rsb.Informer:Publishing data 'sdadsfasdf'
    DEBUG:rsb.Informer:Publishing event 'Event[id = EventId(UUID('6cc2332e-f84b-4cee-aff7-972c0214244e'), 0), scope = 'Scope[/example/informer/]', data = 'sdadsfasdf', type = '<type 'str'>', metaData = MetaData[create = 1340871663.76, send = None, receive = None, deliver = None, userTimes = {}, userInfos = {}], causes = []]'
    DEBUG:rsb.eventprocessing.OutRouteConfigurator:Publishing event: Event[id = EventId(UUID('6cc2332e-f84b-4cee-aff7-972c0214244e'), 0), scope = 'Scope[/example/informer/]', data = 'sdadsfasdf', type = '<type 'str'>', metaData = MetaData[create = 1340871663.76, send = None, receive = None, deliver = None, userTimes = {}, userInfos = {}], causes = []]
    Out[5]: Event[id = EventId(UUID('6cc2332e-f84b-4cee-aff7-972c0214244e'), 0), scope = 'Scope[/example/informer/]', data = 'sdadsfasdf', type = '<type 'str'>', metaData = MetaData[create = 1340871663.76, send = 1340871663.76, receive = None, deliver = None, userTimes = {}, userInfos = {}], causes = []]
    
  4. Problem: no data is received on the C++ side.

rsb.conf is as follows:

ip-129-70-135-195:latex swrede$ cat ~/.config/rsb.conf 
[transport.spread]
enabled = 0

[transport.inprocess]
enabled = 0

[transport.socket]
enabled = 1

bind-to-all-interfaces.patch Magnifier (554 Bytes) J. Moringen, 06/28/2012 12:53 PM

Associated revisions

Revision 6ec7457d
Added by J. Moringen over 9 years ago

Changed default rsb/transport/socket/__init__.py
refs #1042
  • rsb/transport/socket/__init__.py: changed default port 5555 -> 55555

History

#1 Updated by J. Moringen over 9 years ago

Please use netstat to verify that the Python program has opened a socket and the c++ program connects to it.

#2 Updated by S. Wrede over 9 years ago

Output of netstat after Publisher instantiation in Python:

ip-129-70-135-195:~ swrede$ netstat -tlna 
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4       0      0  127.0.0.1.5555         *.*                    LISTEN  

#3 Updated by S. Wrede over 9 years ago

The C++ BusServer (started C++ rsb_listener) seems to behave differently (binding to all interfaces):

ip-129-70-135-195:~ swrede$ netstat -tlna 
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4       0      0  *.55555                *.*                    LISTEN

#4 Updated by J. Moringen over 9 years ago

Also note 5555 vs 55555 :)

#5 Updated by J. Moringen over 9 years ago

Regarding the interface to which the listener port is bound, try the attached patch.

#6 Updated by S. Wrede over 9 years ago

  • Category set to Python
  • Status changed from New to Resolved
  • Assignee set to J. Moringen
  • % Done changed from 0 to 100

The fix for the port number (r3669) solved the problem. This did not show up in the integration tests as we use explicit settings for port / host there.

Also available in: Atom PDF