def send(self,send_data):
if self.__is_addr_reset or \
self._is_close_for_invoker or \
self.__is_connection_closed():
self.__connection = socket(AF_INET,SOCK_STREAM)
if self.__is_ssl:
self.__connection = ssl.wrap_socket(self.__connection)
try :
self.__connection.connect(self.__addr)
self.__connection.settimeout(self.__timeout)
self._is_close_for_invoker = False
self.__is_addr_reset = False
except Exception as exception:
self.__recorder.write(
'Cannot connect %s' % str(self.__addr),
Exception = str(exception))
return None
self.__connection.send(send_data)
return self
评论列表
文章目录