Juniper / grpc-c

C implementation of gRPC layered on top of core library
BSD 3-Clause "New" or "Revised" License
220 stars 59 forks source link

example foo_server foo_client don't not work. #44

Closed jacobkyhsu closed 3 years ago

jacobkyhsu commented 3 years ago

i clone the code from https://github.com/Juniper/grpc-c.git after built it, i started to test the example in grpc-c/build/examples. when i run the example code(foo_server, foo_client), foo_server doesn't receive the request from foo_client. i looked into socket info for foo_server, I found foo_server is listen on IPv6 for 127.0.0.1:3000, it doesn't make sense. because 127.0.0.1 should be for IPv4. And foo_client seems send data to wrong interface. foo_client should send data on 127.0.0.1:3000, right?

  1. why foo_server listen on IPv6 for 127.0.0.1? does it due to foo_server can't receive data from foo_client ?
  2. how to specify the foo_server listen on IPv4 ?
  3. why foo_client send data to wrong interface? In my testing, foo_client send data to 172.xxx.xxx.xxx:3128, the interface and port seems both wrong. (note: i didn't modify any code)
  4. how to set foo_client send data on specified interface & port?

the steps are follows: console 1: $sudo foo_server test

console 2: $sudo foo_client test

console 3: $sudo lsof -i -n -P foo_serve 14209 root 6u IPv6 522525 0t0 TCP 127.0.0.1:3000 (LISTEN) foo_clien 14226 root 7u IPv6 522640 0t0 TCP 192.168.xxx.xxx:49312->172.xxx.xxx.xxx:3128 (SYN_SENT)

does any one encounter the same issue?

jacobkyhsu commented 3 years ago

I found the root cause. it's because the proxy configuration on my ubuntu. foo_client send packets via proxy first, but the proxy dropped it.