Note.
If you execute uwsgi as shown below, you can communicate using the uwsgi protocol.
Putting behind a full webserver
$uwsgi --socket 127.0.0.1:3031 --wsgi-file foobar.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191
However, in the above cases, I felt that the connection test from the client would be troublesome.
I found the following Github issue when I googled
how to test uwsgi unix socket ? #1443
As mentioned above, uwsgi-tools seems to be convenient, so I tried using it.
Installation is possible with pip
$pip install uwsgi-tools
The basic usage is described in the README.
If you are listening to the uwsgi protocol on localhost, you can check it as follows.
$uwsgi_curl localhost:3031
HTTP/1.1 200 OK
Content-Type: text/html
You can also test the connection on a remote host as follows.
$uwsgi_curl hogefuga:3031
HTTP/1.1 200 OK
Content-Type: text/html
ʻImport socket`, and it seems that socket communication is being performed.
https://github.com/andreif/uwsgi-tools/blob/master/uwsgi_tools/curl.py#L9
The protocol works mainly via TCP but the master process can bind to a UDP Unicast/Multicast for The embedded SNMP server or cluster management/messaging requests.
The following is likely to be a study
Let's study socket communication with python
Recommended Posts