472,954 Members | 2,156 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

SOAPpy port reuse

Hi,

I have a problem:

1. Assuming that my application is a SOAP server that uses SOAPpy,
2. I am given port 35021 for use.

What I normally do (simply) is:

functionlist = [<some exposed functions>]
import SOAPpy
server = SOAPpy.SOAPServer((<some host>, 35021))
for func in functionlist: server.registerFunction(func)
server.serve_forever()

My question is: How can I shutdown this server and reuse port 35021 when
my functionlist changes?

Currently, after killing the python process which runs this SOAP server,
the port (35021 in this case) cannot be re-used, as though it is still
phantom-ly bounded to some process (which should have been killed).

Thanks in advance.

Cheers
maurice
Nov 18 '07 #1
4 2760
Maurice LING schrieb:
Hi,

I have a problem:

1. Assuming that my application is a SOAP server that uses SOAPpy,
2. I am given port 35021 for use.

What I normally do (simply) is:

functionlist = [<some exposed functions>]
import SOAPpy
server = SOAPpy.SOAPServer((<some host>, 35021))
for func in functionlist: server.registerFunction(func)
server.serve_forever()

My question is: How can I shutdown this server and reuse port 35021 when
my functionlist changes?

Currently, after killing the python process which runs this SOAP server,
the port (35021 in this case) cannot be re-used, as though it is still
phantom-ly bounded to some process (which should have been killed).
It shouldn't be that way. Either you still have some process lying
around hogging the port. Or the OS needs a while to re-enable the port
for allocation. That happened to me quite a few times.

Shutting down gracefully might speed up things I guess.

Diez
Nov 18 '07 #2
Diez B. Roggisch wrote:
Maurice LING schrieb:
>Hi,

I have a problem:

1. Assuming that my application is a SOAP server that uses SOAPpy,
2. I am given port 35021 for use.

What I normally do (simply) is:

functionlist = [<some exposed functions>]
import SOAPpy
server = SOAPpy.SOAPServer((<some host>, 35021))
for func in functionlist: server.registerFunction(func)
server.serve_forever()

My question is: How can I shutdown this server and reuse port 35021
when my functionlist changes?

Currently, after killing the python process which runs this SOAP
server, the port (35021 in this case) cannot be re-used, as though it
is still phantom-ly bounded to some process (which should have been
killed).

It shouldn't be that way. Either you still have some process lying
around hogging the port. Or the OS needs a while to re-enable the port
for allocation. That happened to me quite a few times.

Shutting down gracefully might speed up things I guess.
I am under the impression that SOAPpy.SOAPServer.serve_forever() is an
"endless" loop. I had been suggested to see if there is a method of
SOAPpy.SOAPServer (which I can call through a wrapper function in
functionlist) that can enable me to gracefully shutdown the server.

Any advice?

Thanks
Maurice
Nov 18 '07 #3
>>>>Maurice LING <ma*********@acm.org(ML) wrote:
>MLHi,
MLI have a problem:
>ML1. Assuming that my application is a SOAP server that uses SOAPpy,
ML2. I am given port 35021 for use.
>MLWhat I normally do (simply) is:
>MLfunctionlist = [<some exposed functions>]
MLimport SOAPpy
MLserver = SOAPpy.SOAPServer((<some host>, 35021))
MLfor func in functionlist: server.registerFunction(func)
MLserver.serve_forever()
>MLMy question is: How can I shutdown this server and reuse port 35021 when my
MLfunctionlist changes?
>MLCurrently, after killing the python process which runs this SOAP server,
MLthe port (35021 in this case) cannot be re-used, as though it is still
MLphantom-ly bounded to some process (which should have been killed).
This phenomenon is explained here:
http://hea-www.harvard.edu/~fine/Tech/addrinuse.html
or the Unix socket FAQ (http://www.faqs.org/faqs/unix-faq/socket/) 2.7

Normally the solution is to set the SO_REUSEADDR option in the socket (the
original one) before binding it:
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR ,1)

However, SOAPPy does that already so it should work.
--
Piet van Oostrum <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: pi**@vanoostrum.org
Nov 18 '07 #4
En Sun, 18 Nov 2007 11:17:42 -0300, Maurice LING <ma*********@acm.org>
escribi�:
Diez B. Roggisch wrote:
>Maurice LING schrieb:
>>My question is: How can I shutdown this server and reuse port 35021
when my functionlist changes?

Shutting down gracefully might speed up things I guess.
I am under the impression that SOAPpy.SOAPServer.serve_forever() is an
"endless" loop. I had been suggested to see if there is a method of
SOAPpy.SOAPServer (which I can call through a wrapper function in
functionlist) that can enable me to gracefully shutdown the server.
serve_forever is inherited from SocketServer.BaseServer and it's just an
infinite loop calling self.handle_request() over and over.
You have to break out of the loop somehow and call self.server_close().
Something like this (untested):

def serve_forever(self):
while not self.some_flag_to_indicate_it_has_to_stop:
self.handle_request()
self.server_close()

--
Gabriel Genellina

Nov 18 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vivek | last post by:
Hi, Can anyone provide me with sample code that will allow me to use SOAPpy with a WSDL file using HTTP basic authentication? The only thing I've been able to find on the net is...
0
by: Harry George | last post by:
I'm trying to setup a SOAPpy service under xinetd. Has someone done this sort of thing? Didn't find it from google searches or documentation. This is probably a sockets-level issue, but I was...
0
by: elsarfhem | last post by:
I have a problem with soappy when i try to send a python dictionary... i send something like this {'1':2,'3':4} and it returns something like this {'1':, '3':4} function on the server is simply an...
0
by: Sameer Deshpande | last post by:
Hi, I am using python SOAPpy module to call a web service. Call to web service gets executed successfully. I am facing a problem if the call to WS results into redirect. I get "HTTPError:...
0
by: benboals | last post by:
Note: this is in reply to a message from August 2 which i found searching for help on my own problem. I couldn't seem to reply to it, but a friend suggested that simply using the same subject...
0
by: linuxprog | last post by:
hi all i'm building a webservice client with soappy when i send some informations it's returns an error here is the informations that generates the error var = SOAPpy.structType()...
0
by: sberry | last post by:
I have a soap server I am running on an OS X Server using SOAPpy. To start the server I am running server = SOAPpy.SOAPServer(('IPADDRESS", PORT), namespace=NAMESPACE) server.serve_forever() I...
0
by: pion | last post by:
Hello I'm trying to make a web service client in python, and so to start out, I found this simple example that are supposed to parse an wsdl file using SOAPPy. I'm using Windows and got SOAPPy...
1
by: Christof Winter | last post by:
I am trying to use a webservice with SOAPpy: import SOAPpy intact_wsdl = "http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl" intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) The...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.