Name Date Size #Lines LOC

..--

.gitignoreH A D25-Apr-202522 32

README.mdH A D25-Apr-20251.5 KiB5135

async_greeter_client.pyH A D25-Apr-20251.2 KiB3818

async_greeter_server.pyH A D25-Apr-20251.5 KiB4826

greeter_client.pyH A D25-Apr-20251.2 KiB3716

greeter_server.pyH A D25-Apr-20251.4 KiB4422

helloworld_pb2.pyH A D25-Apr-20251.4 KiB3118

helloworld_pb2.pyiH A D25-Apr-2025576 1814

helloworld_pb2_grpc.pyH A D25-Apr-20252.3 KiB7155

README.md

1# Unix Domain Socket Example in gRPC Python
2
3## Check Our Guide First
4
5For knowing the basics of gRPC Python and the context around the helloworld example, please checkout our gRPC Python [Quick Start guide](https://grpc.io/docs/languages/python/quickstart).
6
7## Overview
8
9This example demonstrate how gRPC Python can utilize the gRPC Name Resolution mechanism to specify UDS address for clients and servers. The gRPC Name Resolution mechanism is documented at https://github.com/grpc/grpc/blob/master/doc/naming.md.
10
11Specifically, this example will bind the server to the following UDS addresses, and use clients to connect to them:
12
13* `unix:path`: setting the unix domain socket path relatively or absolutely
14* `unix://absolute_path`: setting the absolute path of the unix domain socket
15
16## Prerequisite
17
18The Python interpreter should have `grpcio` and `protobuf` installed.
19
20## Running The Example
21
22Starting the server:
23
24```
25$ python3 greeter_server.py
26INFO:root:Server listening on: unix:helloworld.sock
27INFO:root:Server listening on: unix:///tmp/helloworld.sock
28...
29```
30
31```
32$ python3 async_greeter_server.py
33INFO:root:Server listening on: unix:helloworld.sock
34INFO:root:Server listening on: unix:///tmp/helloworld.sock
35...
36```
37
38Connecting with a client:
39
40```
41$ python3 greeter_client.py
42INFO:root:Received: Hello to unix:helloworld.sock!
43INFO:root:Received: Hello to unix:///tmp/helloworld.sock!
44```
45
46```
47$ python3 async_greeter_client.py
48INFO:root:Received: Hello to unix:helloworld.sock!
49INFO:root:Received: Hello to unix:///tmp/helloworld.sock!
50```
51