pymensago/serverconn.py
def connect(self, address: str, port: int) -> RetVal:
		'''Creates a connection to the server.'''
		try:
			sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
			# Set a short timeout in case the server doesn't respond immediately,
			# which is the expectation as soon as a client connects.
			sock.settimeout(10.0)
		except Exception as e:
			return RetVal().wrap_exception(e)
		
		try:
			sock.connect((address, port))
			
			# absorb the hello string
			_ = sock.recv(READ_BUFFER_SIZE)

		except Exception as e:
			sock.close()
			return RetVal().wrap_exception(e)

		# Set a timeout of 30 minutes
		sock.settimeout(1800.0)
		
		self.socket = sock
		return RetVal()
Creates a connection to the server.
Creates a connection to the server.
Creates a connection to the server .
def connect(self, address: str, port: int) -> RetVal:
		try:
			sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
			sock.settimeout(10.0)
		except Exception as e:
			return RetVal().wrap_exception(e)
		try:
			sock.connect((address, port))
			_ = sock.recv(READ_BUFFER_SIZE)
		except Exception as e:
			sock.close()
			return RetVal().wrap_exception(e)
		sock.settimeout(1800.0)
		self.socket = sock
		return RetVal()
def connect ( self , address : str , port : int ) -> RetVal : try : sock = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) sock . settimeout ( 10.0 ) except Exception as e : return RetVal ( ) . wrap_exception ( e ) try : sock . connect ( ( address , port ) ) _ = sock . recv ( READ_BUFFER_SIZE ) except Exception as e : sock . close ( ) return RetVal ( ) . wrap_exception ( e ) sock . settimeout ( 1800.0 ) self . socket = sock return RetVal ( )
Creates a connection to the server.
Creates a connection to the server .
'''Creates a connection to the server.''' # Set a short timeout in case the server doesn't respond immediately, # which is the expectation as soon as a client connects. # absorb the hello string # Set a timeout of 30 minutes
self
address
str
port
int