ERROR:__init__:205:Can not connect to ('localhost', 9000)
xi-mao opened this issue · 5 comments
- Operating System: Ubuntun18
- UE4 Version: 4.19
- UnrealCV Version: 1.0
- Client (python2, 3 or matlab): python3,
- Problem Description: my unrealcv suddenly can't connect to the environment from yesterday. like this:
from unrealcv import client
client.connect()
ERROR:init:205:Can not connect to ('localhost', 9000)
ERROR:init:206:Error [Errno 111] Connection refused
before,i can connect successfully, but now it failed
Maybe you can address it by reconfiguring the port.
For example, 1) Change the server port to 9001 (See here); 2) Restart the environment; 3) Initialize the Client with the new port, and connect to the game.
@zfw1226 , I have tried to change the port and restart the environment, but it still cnanot connect. Besides, can you tell me how to initialize the client with new port? thanks~
The example code is follwoing:
import unrealcv
ip = '127.0.0.1'
port = 9001
client = unrealcv.Client((ip, port))
Note that the port number of server and client should be consistent.
This may help someone... running Windows with an Ubuntu on WSL2, I always got connection refused
from localhost
or 127.0.0.1
.
So what helped me was this comment on a WSL2 issue regarding not being able to access the Windows host localhost
from the WSL2 container.
After running those commands and enabling avahi
, now I'm able to access the UnrealCV server using a .local
hostname.