cloud_scripts/listen_on_ports.py simple http mock server by tarzanek · Pull Request #2 · vladzcloudius/scripts · GitHub
Skip to content

cloud_scripts/listen_on_ports.py simple http mock server#2

Open
tarzanek wants to merge 1 commit into
vladzcloudius:masterfrom
tarzanek:master
Open

cloud_scripts/listen_on_ports.py simple http mock server#2
tarzanek wants to merge 1 commit into
vladzcloudius:masterfrom
tarzanek:master

Conversation

@tarzanek

Copy link
Copy Markdown
Contributor

This can be used for quick port testing, to start a simple service.

E.g.

$ python3 listen_on_ports.py -a 10.0.2.15 -p 1111 -p 2222 -p 3333

Starting on address 10.0.2.15
  Starting on port 1111
  Starting on port 3333
  Starting on port 2222
Starting on address localhost
  Starting on port 1111
  Starting on port 3333
  Starting on port 2222
All ports are listening, press ENTER key to stop and exit.

$ curl 10.0.2.15:2222
up

This can be used for quick port testing, to start a simple service.

E.g.

$ python3 listen_on_ports.py -a 10.0.2.15 -p 1111 -p 2222 -p 3333

Starting on address 10.0.2.15
  Starting on port 1111
  Starting on port 3333
  Starting on port 2222
Starting on address localhost
  Starting on port 1111
  Starting on port 3333
  Starting on port 2222
All ports are listening, press ENTER key to stop and exit.

$ curl 10.0.2.15:2222
up
@tarzanek

Copy link
Copy Markdown
Contributor Author

@vladzcloudius vladzcloudius left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux has a much more powerful tool for similar things: nc.
Does your script have any advantage on using nc, @tarzanek ?

@tarzanek

Copy link
Copy Markdown
Contributor Author

the only advantage is it gets http reply back
otherwise nc can be used to do similar thing

@vladzcloudius

Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants