Is it possible to write python one-liner, which will be listen on specific tcp port, accept connections, and response nothing.
I can do this in two lines:
import socket; s = socket.socket(socket.AF_INET, socket.SOCK_STREAM); s.bind(("", 5555)); s.listen(1); accepter = s.accept();
while True: data = accepter[0].recv(1024);
But I want to run this from python -c
, So it should be one line.
How can I achieve this?