I need source for start and stop Listener

I am working in SAP BC 4.0.1 and I need the services start and stop of listener, somebody could help me?

Hi,

You can use the built-in services provided by the SAP package to write a service which will restart the listener and schedule it, say after every half an hour.

The following services can be used
sap.admin.listener.list (to fetch the listener id)
sap.admin.listener.stop
sap.admin.listener.start

But whenever I restart the listener quite a few sessions are started at the webMethods end. Can somebody please explain this behaviour.

Regards
Mayur