Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud_scripts/listen_on_ports.py simple http mock server #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tarzanek
Copy link
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
Contributor Author

@vladzcloudius can you merge?

Copy link
Owner

@vladzcloudius vladzcloudius left a comment

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
Contributor Author

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

@vladzcloudius
Copy link
Owner

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

nc supports HTTP too.

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