473,776 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SOAPServ er((<some host>, 35021))
for func in functionlist: server.register Function(func)
server.serve_fo rever()

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 2798
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.SOAPServ er((<some host>, 35021))
for func in functionlist: server.register Function(func)
server.serve_fo rever()

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.SOAPServ er((<some host>, 35021))
for func in functionlist: server.register Function(func)
server.serve_f orever()

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.SOAPServ er.serve_foreve r() is an
"endless" loop. I had been suggested to see if there is a method of
SOAPpy.SOAPServ er (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*********@ac m.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:
>MLfunctionli st = [<some exposed functions>]
MLimport SOAPpy
MLserver = SOAPpy.SOAPServ er((<some host>, 35021))
MLfor func in functionlist: server.register Function(func)
MLserver.serve _forever()
>MLMy question is: How can I shutdown this server and reuse port 35021 when my
MLfunctionli st 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(so cket.SOL_SOCKET ,socket.SO_REUS EADDR,1)

However, SOAPPy does that already so it should work.
--
Piet van Oostrum <pi**@cs.uu.n l>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C 4]
Private email: pi**@vanoostrum .org
Nov 18 '07 #4
En Sun, 18 Nov 2007 11:17:42 -0300, Maurice LING <ma*********@ac m.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.SOAPServ er.serve_foreve r() is an
"endless" loop. I had been suggested to see if there is a method of
SOAPpy.SOAPServ er (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.Ba seServer and it's just an
infinite loop calling self.handle_req uest() over and over.
You have to break out of the loop somehow and call self.server_clo se().
Something like this (untested):

def serve_forever(s elf):
while not self.some_flag_ to_indicate_it_ has_to_stop:
self.handle_req uest()
self.server_clo se()

--
Gabriel Genellina

Nov 18 '07 #5

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

Similar topics

0
2746
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 SOAPpy.URLopener. However, I am unclear what the relationship is between SOAPpy.URLopener and SOAPpy.WSDL is. Is it as straightforward as this? > from SOAPpy import WSDL
0
1880
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 hoping someone in python land had done this with SOAPpy before. The server works fine as simple SOAP server and client pair on localhost. But when I try to put it under xinetd, it fails. Using "xinetd -d" I can see it is failing due to address...
0
1944
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 echo: def echo(arg): return arg i post the soap message, it may be useful... *** Incoming HTTP headers **********************************************
0
1793
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: <HTTPError 302 Moved Temporarily>" If I enable the debug info, I do get the new redirected url. How do I divert my WS request to new url?
0
1017
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 would put it in that thread. In case he's wrong, i quoted the previous comments . Odd-R. wrote: > I use the following piece of code to contact a webservice, > and read a wsdl file. > > from SOAPpy import WSDL > from SOAPpy import URLopener
0
1342
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() var._addItem("code", u"XysZjd") var._addItem("value", 1) when i send the var variable SOAPpy prints this
0
1022
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 am starting the server manually in the background by running from the command line as follows: ../mySOAPServer.py & However, when I log out of my ssh session, the server often stops
0
1975
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 installed using the Enthought Python Distribution. I've tried several wsdl files and commenting out parts of the code etc. but I just can't twist my head around what's the problem here. Any help would be greatly appreciated. soappyTest.py: from...
1
5994
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 resulting error message is posted below. If I understand it right, XMLSchema.py complains about the imported XSD namespace being the same as the existing targetNamespace.
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10292
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.