Python Forum
program wanted in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
program wanted in python
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Doesn't twisted or select handle this ?
Python select
Twisted
99 percent of computer problems exists between chair and keyboard.
Reply
#3
(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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python code wanted: grep IP address Skaperen 7 6,119 Jul-09-2018, 05:25 AM
Last Post: Skaperen
  program wanted: diff that ignores numbers Skaperen 0 1,919 Jun-16-2018, 02:05 AM
Last Post: Skaperen
  program wanted: clean up pyc files Skaperen 6 5,718 Jun-13-2017, 05:42 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020