cheusov / dictd

Client/server software, human language dictionary databases, and tools supporting the DICT protocol (RFC 2229)
71 stars 10 forks source link

"Cannot connect to any servers" (but I can telnet to the server) #14

Open jbrea opened 2 years ago

jbrea commented 2 years ago

I ran into a weird behavior: Everything runs normally when I am connected to the internet (wlan or ethernet), e.g.

$ dict -I -v
Configuration file:
   server localhost
  dictd 1.13.1/rf on Linux 5.17.4-arch1-1
  On machina: up 11:07, 8 forks (43.2/hour)

  Database      Headwords         Index          Data  Uncompressed
  moby-thesaurus      30263        528 kB         10 MB         28 MB

When I am offline I get

$ dict -I -v
Configuration file:
   server localhost
Cannot connect to any servers

but I can still access and query the local dict server with

$ telnet localhost 2628

Any ideas why dict fails to connect to the server when I am offline?

cheusov commented 2 years ago

1) Have a look at dict.conf configuration file 2) Does "dict -h localhost -p 2628 -I -v" work as expected in both cases? 3) What does "netstat -lntp | grep 2628" say?

jbrea commented 2 years ago

Thanks for the support!

  1. This is my dict.conf
    # Usually all you will ever need here is the server keywords.
    # Refer to the dict manpage for other options.
    # It will only check the second server if the first fails
    server localhost
    # server dict.org
  2. "dict -h localhost -p 2628 -I -v" works as expected when I am connected to the internet. Otherwise it returns
    $ dict -h localhost -p 2628 -I -v
    Configuration file:
    server localhost
    Cannot connect to any servers
  3. I'm on archlinux and use ss instead of netstat.
    $ ss -lntp | grep 2628
    LISTEN 0      10           0.0.0.0:2628      0.0.0.0:*    
cheusov commented 2 years ago
  1. Is your hostname "localhost" assigned to 127.0.0.1 or something like this and lo0 network interface is up? What does "ifconfig" command or equivalent "ip" says about running network interfaces?
  2. Do you use latest github version "dict" or latest stable release version?
jbrea commented 2 years ago

Thanks.

1.

$ getent hosts  
127.0.0.1       localhost
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
  1. This is the version I use: dictd 1.13.1/rf on Linux 5.17.5-arch1-1.