parameters: (self, server)
docstring: do the work of sending a TCP request
docstring_summary: do the work of sending a TCP request
docstring_tokens: do the work of sending a TCP request
function: def sendTCPRequest(self, server):
          " do the work of sending a TCP request "
          self.response=None
          for self.ns in server:
              #print "trying tcp",self.ns
              try:
                  if self.ns.count(':'):
                      if hasattr(socket,'has_ipv6') and socket.has_ipv6:
                          self.socketInit(socket.AF_INET6, socket.SOCK_STREAM)
                      else: continue
                  else:
                      self.socketInit(socket.AF_INET, socket.SOCK_STREAM)
                  try:
                      # TODO. Handle timeouts &c correctly (RFC)
                      self.time_start=time.time()
                      self.conn()
                      buf = Lib.pack16bit(len(self.request))+self.request
                      # Keep server from making sendall hang
                      self.s.setblocking(1)
                      # FIXME: throws WOULDBLOCK if request too large to fit in
                      # system buffer
                      self.s.sendall(buf)
                      #self.s.shutdown(socket.SHUT_WR)
                      r=self.processTCPReply()
                      if r.header['id'] == self.tid:
                          self.response = r
                          break
                  finally:
                      self.s.close()
              except socket.error:
                  continue
function_tokens: def sendTCPRequest ( self , server ) : self . response = None for self . ns in server : #print "trying tcp",self.ns try : if self . ns . count ( ':' ) : if hasattr ( socket , 'has_ipv6' ) and socket . has_ipv6 : self . socketInit ( socket . AF_INET6 , socket . SOCK_STREAM ) else : continue else : self . socketInit ( socket . AF_INET , socket . SOCK_STREAM ) try : # TODO. Handle timeouts &c correctly (RFC) self . time_start = time . time ( ) self . conn ( ) buf = Lib . pack16bit ( len ( self . request ) ) + self . request # Keep server from making sendall hang self . s . setblocking ( 1 ) # FIXME: throws WOULDBLOCK if request too large to fit in # system buffer self . s . sendall ( buf ) #self.s.shutdown(socket.SHUT_WR) r = self . processTCPReply ( ) if r . header [ 'id' ] == self . tid : self . response = r break finally : self . s . close ( ) except socket . error : continue