"IO::Socket::INET: Bad protocol 'tcp'"

From Brandonhutchinson.com

Revision as of 23:22, 18 August 2008 by Hutch (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
IO::Socket::INET: Bad protocol 'tcp' at /tmp/script.pl line 7, <DATA> line 225.

You may receive this error if your system cannot convert the tcp protocol to its number using getprotobyname().

$ getent protocols tcp
$

In my case, this happened because after configuring a Solaris LDAP client using ldapclient. This command copies /etc/nsswitch.ldap over /etc/nsswitch.conf. The problematic line:

$ grep protocols /etc/nsswitch.conf
protocols:  ldap [NOTFOUND=return] files

I changed the line to:

protocols:  files ldap

and had no more problems.

$ getent protocols tcp
tcp                  6 TCP

Links

Personal tools