Skip to main content

build+test complexity vulnerabilities PyPI version python

wait-for-message

A simple client server utility that blocks until a message is received on a TCP/IP socket connection; useful for synchronizing interdependent networked jobs.

Installation

pip install wait-for-message

w4m Usage

usage: w4m [-h] {send,wait} ...

A simple client server utility that blocks until a message is received on a TCP/IP socket connection

positional arguments:
  {send,wait}
    send       send message to tcp/ip connection until acknowledged or maximum attempts
    wait       wait for message on tcp/ip connection until received or timeout

optional arguments:
  -h, --help   show this help message and exit

w4m send

send message to tcp/ip connection until acknowledged or maximum attempts

usage: w4m send [-h] --ip-address IP_ADDRESS --port-number PORT_NUMBER --message MESSAGE_TO_SEND [--delay DELAY] [--attempts MAX_ATTEMPTS]

optional arguments:
  -h, --help            show this help message and exit
  --ip-address IP_ADDRESS
                        the ip address of the server
  --port-number PORT_NUMBER
                        the port number the server is listening on
  --message MESSAGE_TO_SEND
                        the message to send
  --delay DELAY         number of seconds to delay between retries; default 10
  --attempts MAX_ATTEMPTS
                        maximum retry attempts; default 6

w4m wait

wait for message on tcp/ip connection until received or timeout - if message received and if it contains a body print it to stdout

usage: w4m wait [-h] [--ip-address IP_ADDRESS] --port-number PORT_NUMBER --message MESSAGE_TO_WAIT_FOR [--timeout TIMEOUT]

optional arguments:
  -h, --help            show this help message and exit
  --ip-address IP_ADDRESS
                        the ip address to bind to; default 0.0.0.0
  --port-number PORT_NUMBER
                        the port number to listen on
  --message MESSAGE_TO_WAIT_FOR
                        the message to wait for
  --timeout TIMEOUT     number of seconds to wait for message; default 900 (i.e. 15 minutes)

Example

wait

On a Linux machine, start tcp/ip socket listening on port 8080 and wait for message. Note the script blocks until the expected message is received. If the message is not received a timeout error will be thrown. If the message received contains a body it is printed to stdout.

w4m wait --port-number 8080 --message "ready to proceed"

send

On an other machine (this example we used a Windows machine), connect tcip/ip socket to the ip:port for the server and send several messages. Send will resend message until an acknowledgement is received. If no acknowledgement is received after max attempts a MaxAttemptsError is thrown.

w4m send --ip-address 192.168.1.199 --port-number 8080 --message "a message"
w4m send --ip-address 192.168.1.199 --port-number 8080 --message "another message"
w4m send --ip-address 192.168.1.199 --port-number 8080 --message "ready to proceed:message body"

example1

Development

Build the Docker image:

docker image build \
-t w4m:latest .

Run the Docker container:

docker container run \
--rm \
-it \
-v $PWD:/code \
-p:8080:8080 \
w4m:latest \
bash

Metadata

Release files for wait-for-message 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wait-for-message 0.1.8
File Size Uploaded Provenance
wait-for-message-0.1.8.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wait-for-message 0.1.8
File Interpreter ABI Platform
wait_for_message-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / wait-for-message-0.1.8.tar.gz

Download URL wait-for-message-0.1.8.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
eaec21234d5a144594f7f11bb553d47d1ad9b5b7cde33eb6b340939ed234c411
BLAKE2b-256 checksum
How to use checksums
1e4c724a9fa42bab7f24f43a51c0538765d38950879802550442d1c14d09d43e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / wait_for_message-0.1.8-py3-none-any.whl

Download URL wait_for_message-0.1.8-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b63c2617f408edd38a0402d4070af65ff7b9ae2a052bed4330d13823167740b3
BLAKE2b-256 checksum
How to use checksums
afbb99a6083c380c4cf80723a9a9ae98e948947fb99f95dfc29c0952fab0f809
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for wait-for-message 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page