2

I have a simple gRPC service(written in C#) running on my Raspberry Pi. I'm using Kreya to send a message and get a response back. It seems to only work if I send a message from a client running on the Pi but can't do the same from another computer. It shows the port is LISTENING so I'm confused. I'm not experienced in networking so any help would be appreciated.

enter image description here

enter image description here

enter image description here

UPDATE FOR .NET 6.0

All that is required to get the application to listen for any ip connection is to simply add the following to the Program.cs file. This will override any other configurations.

    var builder = WebApplication.CreateBuilder(args);

    builder.WebHost.ConfigureKestrel(options => options.ListenAnyIP(9000));

1 Answers1

1

localhost which generally resolves to 127.0.0.1 is a special network address.

It is a way for a host to refer to itself (generally) without using the (full) network stack.

In this case, it appears your gRPC server is only bound to localhost and, as a result, is only accessible to itself from other connections using the localhost address.

This explains why it can talk to itself but why other hosts are unable to access it. NOTE The other hosts using localhost are referring to their own localhost|loopback address.

You will need to reconfigure your gRPC server to bind to a specific network address. Often you can achieve this using 0.0.0.0 instead of localhost (or 127.0.0.1)

DazWilkin
  • 32,823
  • 5
  • 47
  • 88