INNER CODE UNIT · Python
connect
unrealcv/unrealcv · client/python/unrealcv/__init__.py:307
def connect(self, timeout=1, start_receive_thread=True):
"""
Try to connect to server, return whether connection successful
"""
if self.isconnected():
return True
s = None
try:
if self.type == 'unix':
print('=>Info: using uds socket')
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
elif self.type == 'inet':
print('=>Info: using ip-port socket')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
else:
raise NotImplementedError