Package rospy :: Package impl :: Module tcpros_pubsub :: Class TCPROSHandler

Class TCPROSHandler

source code

               object --+    
                        |    
transport.ProtocolHandler --+
                            |
                           TCPROSHandler

ROS Protocol handler for TCPROS. Accepts both TCPROS topic connections as well as ROS service connections over TCP. TCP server socket is run once start_server() is called -- this is implicitly called during init_publisher().

Instance Methods
 
__init__(self)
ctor
source code
 
set_tcp_nodelay(self, resolved_name, tcp_nodelay) source code
 
shutdown(self)
stops the TCP/IP server responsible for receiving inbound connections
source code
(int, str, int)
create_transport(self, resolved_name, pub_uri, protocol_params)
Connect to topic resolved_name on Publisher pub_uri using TCPROS.
source code
bool
supports(self, protocol)
Returns: True if protocol is supported
source code
 
get_supported(self)
Get supported protocols
source code
(int, str, list)
init_publisher(self, resolved_name, protocol)
Initialize this node to receive an inbound TCP connection, i.e.
source code
str
topic_connection_handler(self, sock, client_addr, header)
Process incoming topic connection.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

ctor

Overrides: object.__init__

set_tcp_nodelay(self, resolved_name, tcp_nodelay)

source code 
Parameters:
  • resolved_name (str) - resolved topic name
  • tcp_nodelay (bool) - If True, sets TCP_NODELAY on publisher's socket (disables Nagle algorithm). This results in lower latency publishing at the cost of efficiency.

shutdown(self)

source code 

stops the TCP/IP server responsible for receiving inbound connections

Overrides: transport.ProtocolHandler.shutdown

create_transport(self, resolved_name, pub_uri, protocol_params)

source code 

Connect to topic resolved_name on Publisher pub_uri using TCPROS.

Parameters:
  • resolved_name (str), str - resolved topic name
  • pub_uri (str) - XML-RPC URI of publisher
  • protocol_params ([XmlRpcLegal]) - protocol parameters to use for connecting
Returns: (int, str, int)
code, message, debug
Overrides: transport.ProtocolHandler.create_transport

supports(self, protocol)

source code 
Parameters:
  • protocol (str) - name of protocol
Returns: bool
True if protocol is supported
Overrides: transport.ProtocolHandler.supports

get_supported(self)

source code 

Get supported protocols

Overrides: transport.ProtocolHandler.get_supported

init_publisher(self, resolved_name, protocol)

source code 

Initialize this node to receive an inbound TCP connection, i.e. startup a TCP server if one is not already running.

Parameters:
  • resolved_name - topic name
  • protocol ([str, value*]) - negotiated protocol parameters. protocol[0] must be the string 'TCPROS'
  • resolved__name (str)
Returns: (int, str, list)
(code, msg, [TCPROS, addr, port])
Overrides: transport.ProtocolHandler.init_publisher

topic_connection_handler(self, sock, client_addr, header)

source code 

Process incoming topic connection. Reads in topic name from handshake and creates the appropriate TCPROSPub handler for the connection.

Parameters:
  • sock (socket.socket) - socket connection
  • client_addr ((str, int)) - client address
  • header (dict) - key/value pairs from handshake header
Returns: str
error string or None