#NEWLINE# def connect( self ) : #NEWLINE# #INDENT# self . sock = socket . socket ( ) #NEWLINE# try : #NEWLINE# #INDENT# self . sock . connect ( ( self . host , self . port ) ) #NEWLINE# #UNINDENT# except socket . error : #NEWLINE# #INDENT# raise RConnectionRefused ( 'Connection denied, server not reachable or not accepting connections' ) #NEWLINE# #UNINDENT# time . sleep ( 0.2 ) #NEWLINE# hdr = self . sock . recv ( 1024 ) #NEWLINE# self . __closed = False #NEWLINE# if DEBUG : #NEWLINE# #INDENT# print ( ( 'received hdr %s from rserve' % self ) ) #NEWLINE# #UNINDENT# assert hdr . startswith ( b'Rsrv01' ) , 'Protocol error with Rserv, obtained invalid header string'