Servname not supported for ai_socktype
Solution 1
I had this problem with a Tornado/Python app. Apparently, this can be caused by the port being interpreted as a string instead of an integer. So in my case, I needed to change my startup script to force it to be interpreted as an integer.
application = tornado.web.Application(...)
application.listen(int(port))
Solution 2
Are you able to enter your client ? before trying to sync the files, try to create a perforce client:
p4 client
Maybe it's not the host:port that is the issue, but other flags in the connection string that interrupt.
I personally received the exact same error, but it was a Perforce issue.
The reason is, Perforce has its own priority when it's looking for its P4USER/P4PORT/... configuration.
- ENV variables ( run
export) - if a
P4CONFIGvariable was specified somewhere it can search in a file ( like.perforcein the current/upper directory )
Problem was, even though it first search for an ENV variable - the P4CONFIG file might override it.
So my $P4PORT ENV variable had a connection string X, but the .perforce file had a connection string Y.
Removing the P4PORT from my local .perforce file - solved this issue.
in example:
$~] echo $P4PORT;
rsh:ssh -2 -q -a -x -l p4ssh perforce.mydomain.com
$~] cat .perforce
# P4PORT="rsh:ssh -q -a -x -l perforce.mydomain.com /bin/true"
P4USER="my_user"
Also remember that Perforce will search for the $P4CONFIG file ( if configured one ) in the entire directory hierarchy upwards, so even if you don't have the file in the current directory - it might be found in an upper directory, and there - you might have a $P4PORT configuration that you didn't expect..
Solution 3
Put trailing slash, e.g.:
http://perforce.xxx.com:1666/
Instead of:
http://perforce.xxx.com:1666
Related videos on Youtube
Tavo
SOreadytohelp Spanish Software Engineer; developed my career in the UK; live in Singapore now. Mostly Java core. Mostly.
Updated on July 09, 2022Comments
-
Tavo 6 monthsI'm running a Centos virtual machine using Vagrant. The machine seems to run properly, but when I try to sync Perforce I can see the following error:
[[email protected]_64 ~]$ /perforce/p4 sync -f ... Perforce client error: Connect to server failed; check $P4PORT. failed.TCP connect to perforce.xxx.com:1666 Servname not supported for ai_socktypeI have read this http://www.ducea.com/2006/09/11/error-servname-not-supported-for-ai_socktype/ and tried to set the ports in
/etc/services, but it didn't work. I am not even sure if the problem is Perforce or OS related.Any hints?
-
pitseekerHave you set P4PORT correctly?
-
-
Kerwin Sneijders almost 3 yearsCompletely different library (Kafka-Python) but this resolved my problem! Thanks