Python Forum

Full Version: program wanted in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what i would like to have in Python (i already have it in C) is a program that starts as a command that take a port number, a remote host name or remote IP address, and a remote port number, and then drops into the background and releases the controlling tty (so it won't be killed when the user logs out). it then listens to the first port number for incoming TCP connections and waits. when a connection comes in, it forks a child process (not thread) to handle it, and resumes waiting for more incoming connections. the child (just one process per incoming connection) connects to the remote host and port specified by 2nd and 3rd command arguments. once the connection is complete, it transfers all data, 8 bits wide, in both directions, between the incoming TCP connect and the connection it made to a remote host. when either side disconnects, it completes sending the final data, starts a 10 second timeout to exit, and waits.
Doesn't twisted or select handle this ?
Python select
Twisted
(Aug-06-2018, 03:20 PM)Windspar Wrote: [ -> ]Doesn't twisted or select handle this ?
Python select
Twisted
those functions, alone, don't do it. did you mean they enable such code? or maybe i missed something?

i don't know the features of twisted, yet.

a variation of that program i would like to see is one that reads in a file that lists many ports to listen to, with a distinct destination host and port for each. IPv6 is necessary in this case. the use case is a VPS provider that offers IPv6 only virtual servers with this program on an IPv4-reachable host providing a port addressed means to SSH to these servers for people without IPv6.