Search code examples
socketscentosipportperforce

Servname not supported for ai_socktype


I'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:

[vagrant@vagrant-c5-x86_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_socktype

I 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?


Solution

  • 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))