parameters: (self, data)
return_statement: return True
docstring: Write raw data to transport
          @raise TransportInitialiationError: could not be initialized
          @raise TransportTerminated: no longer open for publishing
docstring_summary: Write raw data to transport
docstring_tokens: Write raw data to transport
function: def write_data(self, data):
          """
          Write raw data to transport
          @raise TransportInitialiationError: could not be initialized
          @raise TransportTerminated: no longer open for publishing
          """
          if not self.socket:
              raise TransportInitError("TCPROS transport was not successfully initialized")
          if self.done:
              raise TransportTerminated("connection closed")
          try:
              #TODO: get rid of sendalls and replace with async-style publishing
              self.socket.sendall(data)
              self.stat_bytes  += len(data)
              self.stat_num_msg += 1
          except IOError as ioe:
              #for now, just document common errno's in code
              (errno, msg) = ioe.args
              if errno == 32: #broken pipe
                  logdebug("ERROR: Broken Pipe")
                  self.close()
                  raise TransportTerminated(str(errno)+msg)
              raise #re-raise
          except socket.error as se:
              #for now, just document common errno's in code
              (errno, msg) = se.args
              if errno == 32: #broken pipe
                  logdebug("[%s]: Closing connection [%s] due to broken pipe", self.name, self.endpoint_id)
                  self.close()
                  raise TransportTerminated(msg)
              elif errno == 104: #connection reset by peer
                  logdebug("[%s]: Peer [%s] has closed connection", self.name, self.endpoint_id) 
                  self.close()
                  raise TransportTerminated(msg)
              else:
                  rospydebug("unknown socket error writing data: %s",traceback.format_exc())
                  logdebug("[%s]: closing connection [%s] due to unknown socket error: %s", self.name, self.endpoint_id, msg) 
                  self.close()
                  raise TransportTerminated(str(errno)+' '+msg)                
          return True
function_tokens: def write_data ( self , data ) : if not self . socket : raise TransportInitError ( "TCPROS transport was not successfully initialized" ) if self . done : raise TransportTerminated ( "connection closed" ) try : #TODO: get rid of sendalls and replace with async-style publishing self . socket . sendall ( data ) self . stat_bytes += len ( data ) self . stat_num_msg += 1 except IOError as ioe : #for now, just document common errno's in code ( errno , msg ) = ioe . args if errno == 32 : #broken pipe logdebug ( "ERROR: Broken Pipe" ) self . close ( ) raise TransportTerminated ( str ( errno ) + msg ) raise #re-raise except socket . error as se : #for now, just document common errno's in code ( errno , msg ) = se . args if errno == 32 : #broken pipe logdebug ( "[%s]: Closing connection [%s] due to broken pipe" , self . name , self . endpoint_id ) self . close ( ) raise TransportTerminated ( msg ) elif errno == 104 : #connection reset by peer logdebug ( "[%s]: Peer [%s] has closed connection" , self . name , self . endpoint_id ) self . close ( ) raise TransportTerminated ( msg ) else : rospydebug ( "unknown socket error writing data: %s" , traceback . format_exc ( ) ) logdebug ( "[%s]: closing connection [%s] due to unknown socket error: %s" , self . name , self . endpoint_id , msg ) self . close ( ) raise TransportTerminated ( str ( errno ) + ' ' + msg ) return True