port doubling (or...)?
maximilianscherr
MaximilianScherr at T-Online.de
Tue Jan 29 14:29:58 EST 2002
hmm would this work?
i made a bit witht he socketserver module, but dunno if that will
work or if it's useless performance loss.
it works like this:
the client connects to the pserver, then it sends data to uoserver.
if the uoserver connects the pserver sends the data to the client.
note: the pserver is on the machine which runs the client to keep
performance on the uoserver pc low.
or how would i do that or what would be the advantages or
disadvantages?
sorry for the long posts and annoying questions.
thanks in advance
this give sme errors:( i the ipaddrmatch line:
def getipaddr():
smtpconn = smtplib.SMTP("mail.mojam.com")
smtpconnhelo = smtpconn.helo()
smtpconn.quit()
ipaddrmatch = re.search("([0-9] + \.[0-9] + \.[0-9] + \.[0-9]
+ )", smtpconnhelo)
if ipadrrmatch is not None:
return ipaddrmatch.group(1)
the server code:
def startps():
class psrequesthandler(SocketServer.StreamRequestHandler):
def handle(self):
reqaddr = self.client_address()
reqipaddr = socket.gethostbyname(reqaddr[1])
cliaddr = ()
if reqipaddr == getipaddr():
try:
cliaddr = reqaddr
uoanas3 = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
uoanas3.connect(("uoana.dyndns.org", 5003))
smsgstr3 = self.rfile()
while len(smsgstr3):
smsgstr3 = smsgstr3[smsgstr3.send(smsgstr3):]
uoanas3.close()
except:
tkMessageBox.showerror("Error", "Couldn't connect
to server!")
if reqipaddr == socket.gethostbyname("uoana.dyndns.org"):
try:
uoanas4 = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
uoanas4.connect(cliaddr)
smsgstr4 = self.rfile()
while len(smsgstr4):
smsgstr4 = smsgstr4[smsgstr4.send(smsgstr4):]
uoana4.close()
except:
tkMessageBox.showerror("Error", "Couldn't connect
to server!")
ps = SocketServer.ThreadingTCPServer((getipaddr(), 5002),
psrequesthandler)
ps.serve_forever()
please tell me what i do wrong or not, couldn't test the server code
due to erors in the getip def.
--- In python-list at y..., Cliff Wells <logiplexsoftware at e...> wrote:
> On Tue, 29 Jan 2002 00:37:50 -0000
> maximilianscherr wrote:
>
> > so this whole thing won't work?
>
> Not the way you outlined it below. What I'm saying is that the
pyserver is
> going to have to sit between the client and server and handle
packets going
> both directions.
>
> client --> pyserver (process packets) --> server
> client <-- pyserver (no processing) <-- server
>
>
>
> > --- In python-list at y..., Cliff Wells <logiplexsoftware at e...>
wrote:
> > > On Mon, 28 Jan 2002 22:57:50 -0000
> > > maximilianscherr wrote:
> > >
> > > > one big (?) problem:
> > > >
> > > > the server needs to know the client ip to send packets back.
> > > > i want to do this:
> > > > client -send-> pyserver -send-> ultimaonlineserver -send->
client
> > > >
> > > > how can i do this, like pretending the pyservers ip would be
the
> > > > client one.
> > > >
> > >
> > > I don't think there's an easy way to accomplish this (or even a
> > difficult
> > > way) without being able to modify the server. However, the
data
> > stream
> > > going back should have a lot less overhead since the python
program
> > > wouldn't actually process it, but simply pass it through.
> > >
> > > > Thanks in advance,
> > > >
> > > > -Max
> > > >
> > > > --- In python-list at y..., Cliff Wells <logiplexsoftware at e...>
> > wrote:
> > > > > On Mon, 21 Jan 2002 22:48:51 -0000
> > > > > maximilianscherr wrote:
> > > > >
> > > > > > > can you run the server on a diffrent port? you could
filter
> > > > > > incomming
> > > > > > > requests on your server running on the original port
and
> > just
> > > > pass
> > > > > > along
> > > > > > > the ones you not interested in to the original server.
> > > > > > > this could also be done with two machines, without
changing
> > > > ports.
> > > > > > >
> > > > > >
> > > > > > the uo client / server stuff works like this:
> > > > > > specify:
> > > > > > server: ip(s, yes ips,just checked), some port , mine:
5003
> > > > > > client: server ip, sertver port.
> > > > > >
> > > > > > what can i do with this?,
> > > > >
> > > > > The logic is very simple, the implementation less so, but
still
> > not
> > > > too
> > > > > difficult:
> > > > >
> > > > > - configure your uo server to listen on port A
> > > > > - configure your Python program to listen on port B
> > > > > - configure your uo client to transmit to port B
> > > > > - your Python server then accepts all packets on port B,
and
> > then
> > > > forwards
> > > > > whatever ones it isn't interested in to port A
> > > > > - anything your Python program receives from port A it
forwards
> > to
> > > > the
> > > > > client
> > > > >
> > > > > Basically, to the server, it looks like your Python program
is
> > the
> > > > client,
> > > > > and to the client, it looks like the Python program is the
> > server.
> > > > >
> > > > >
> > > > > --
> > > > > Cliff Wells
> > > > > Software Engineer
> > > > > Logiplex Corporation (www.logiplex.net)
> > > > > (503) 978-6726 x308
> > > > > (800) 735-0555 x308
> > > > >
> > > > > --
> > > > > http://mail.python.org/mailman/listinfo/python-list
> > > >
> > > >
> > > > --
> > > > http://mail.python.org/mailman/listinfo/python-list
> > >
> > >
> > > --
> > > Cliff Wells
> > > Software Engineer
> > > Logiplex Corporation (www.logiplex.net)
> > > (503) 978-6726 x308
> > > (800) 735-0555 x308
> > >
> > > "Then with your new power you'll accomplish all sorts of cool
stuff
> > > in no time, and We'll All Be Sorry. At that point you can
either
> > > gloat a bit, and then relent, or go ahead and send the robot
army
> > > after us." - Quinn Dunkan
> > >
> > > --
> > > http://mail.python.org/mailman/listinfo/python-list
> >
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
>
> --
> Cliff Wells
> Software Engineer
> Logiplex Corporation (www.logiplex.net)
> (503) 978-6726 x308
> (800) 735-0555 x308
>
> "Then with your new power you'll accomplish all sorts of cool stuff
> in no time, and We'll All Be Sorry. At that point you can either
> gloat a bit, and then relent, or go ahead and send the robot army
> after us." - Quinn Dunkan
>
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list