about soaplib demo's time latency

2011-04-14 Thread Stephen.Wu
I just follow the instructions below - 
http://soaplib.github.com/soaplib/2_0/pages/helloworld.html
to establish a soap server. After starting the server, everytime I run
the client script, I fetch the response nearly 20 seconds afterward.
Why this happen?
I just want the server send response asap then the client will show
the result to me immediately.

please give some hints. thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: about soaplib demo's time latency

2011-04-14 Thread Stephen.Wu
On Apr 14, 5:18 pm, Chris Angelico  wrote:
> On Thu, Apr 14, 2011 at 6:43 PM, Stephen.Wu <54wut...@gmail.com> wrote:
> > I just follow the instructions below 
> > -http://soaplib.github.com/soaplib/2_0/pages/helloworld.html
> > to establish a soap server. After starting the server, everytime I run
> > the client script, I fetch the response nearly 20 seconds afterward.
> > Why this happen?
> > I just want the server send response asap then the client will show
> > the result to me immediately.
>
> > please give some hints. thanks
>
> Not sure if it's what you're seeing, but you might have an issue with
> reverse DNS. When the client connects, the server tries to look up its
> PTR record for its log. You can speed this up by either having such a
> record, or having an authoritative DNS server that returns an
> immediate failure; either option is fairly easy if you run BIND, but
> you might be able to do it with your hosts file (/etc/hosts or
> c:\windows\system32\drivers\etc\hosts) instead - just put in an entry
> for your client computer and some hostname.
>
> Hope that helps!
>
> Chris Angelico

Thanks Chris.
I recheck the logic line by line and I find it is this sentence drag
speed down :  hello_client = Client('http://localhost:7789/?wsdl').
To initialize a suds.client.Client instance need that long lasting 20
seconds?
On your suggestion, if I just want to run the server localhost, how
should I set up the local \etc\hosts file?

thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: about soaplib demo's time latency

2011-04-14 Thread Stephen.Wu
On Apr 14, 9:39 pm, Chris Angelico  wrote:
> On Thu, Apr 14, 2011 at 11:30 PM, Stephen.Wu <54wut...@gmail.com> wrote:
> > Thanks Chris.
> > I recheck the logic line by line and I find it is this sentence drag
> > speed down :  hello_client = Client('http://localhost:7789/?wsdl').
> > To initialize a suds.client.Client instance need that long lasting 20
> > seconds?
> > On your suggestion, if I just want to run the server localhost, how
> > should I set up the local \etc\hosts file?
>
> It's probably already there for localhost; check the file I named and
> see if there's a line looking like:
>
> 127.0.0.1   localhost
>
> If there is, you should be able to get reverse DNS for 127.0.0.1. The
> other possibility there is that it's the _forward_ DNS that's slow
> (although I don't know why it would be). Try the IP instead:
>
> hello_client = Client('http://127.0.0.1:7789/?wsdl')
>
> Chris Angelico

It works. Seems the DNS server will exchange localhost and 127.0.0.1,
taking nearly 15 seconds. Anyway, I got to know the exactly reason let
the initialized procedures down, which is the most important thing.
Thanks again.
-- 
http://mail.python.org/mailman/listinfo/python-list


which one is faster?

2010-01-29 Thread Stephen.Wu
str.find(targetStr)
str.index(targetStr) with exception
str.count(targetStr)
targetStr in str

which is the fastest way to check whether targetStr is in str?

thanks all
-- 
http://mail.python.org/mailman/listinfo/python-list


is there any FIX message handle modules in Python?

2009-11-18 Thread Stephen.Wu
FIX message is the "Financial information Exchange" protocol
messages...
any 3rd libs we have?
-- 
http://mail.python.org/mailman/listinfo/python-list


how long a Str can be used in this python code segment?

2010-02-01 Thread Stephen.Wu
tmp=file.read() (very huge file)
if targetStr in tmp:
print "find it"
else:
print "not find"
file.close()

I checked if file.read() is huge to some extend, it doesn't work, but
could any give me some certain information on this prolbem?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how long a Str can be used in this python code segment?

2010-02-01 Thread Stephen.Wu
On Feb 1, 5:26 pm, Chris Rebert  wrote:
> On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu <54wut...@gmail.com> wrote:
> > tmp=file.read() (very huge file)
> > if targetStr in tmp:
> >    print "find it"
> > else:
> >    print "not find"
> > file.close()
>
> > I checked if file.read() is huge to some extend, it doesn't work, but
> > could any give me some certain information on this prolbem?
>
> If the file's contents is larger than available memory, you'll get a
> MemoryError. To avoid this, you can read the file in by chunks (or if
> applicable, by lines) and see if each chunk/line matches.
>
> Cheers,
> Chris
> --http://blog.rebertia.com

actually, I just use file.read(length) way, i just want to know what
exactly para of length I should set, I'm afraid length doesn't equal
to the amount of physical memory after trials...
-- 
http://mail.python.org/mailman/listinfo/python-list