Am 13.03.2014 15:55, schrieb Amitabh Arya:
> :) My name is Amitabh I work at Miami USA, and my company give me
> another name Chuck James as Amitabh is hard to speak for some of them.
> So most of my friend call me Chuck. But when I write/reply emails I use
> Amitabh as thats what I have on my resume. I know confusing sorry :).
Ahhh;) Thanks!
"Amitabh": also complicated for Germans .. in fact, I have no clue how
to pronounce correctly.
>
> I do understand your code, but here is my requirement in detail:
> I have an application.xml which have information about application
> multiple ports and other servers. My server application (autobahn)
> supposed to run that xml after every 15 mins. And connect/disconnect to
> other server accordingly. In this 15 mins the server admin guy can
> modify the xml incase of code push or reset the cluster.
I see. But no problem also:
def foo():
config = read_config()
reactor.connectTCP(config.port, config.host, ...)
>
> But I used your code and got my issue fixed :) thanks a ton buddy.
Great.
>
> So, in short, in reactor is running, we just need to use connectTCP or
> ListenTCP and it will auto connect or auto start listening. Thats great
> about twisted :).
It's working like this:
1) When your program starts, you wire up everything that should happen
.. now or in the future.
2) Start the reactor.
Then Twisted will figure out and make sure everything happens according
to how you wired up stuff.
"auto-reconnect": If you mean, automatically reconnect to a host
(previously connected to) when connection is lost, then no, you need to
do that yourself. Or you Twisted ReconnectingClientFactory ..
>
> *I have small question, Can we listen/connect ports on a subprocess also
> (Subprocess using reactor.spawnProcess method). If yes then, is there a
> default timeout for subprocesses at linux?*
You can spawn a subprocess from Twisted. That subprocess can be anything
.. it can be Python based or not. And if Python, it can use Twisted or
not. If so, it'll run it's own reactor.
https://twistedmatrix.com/documents/current/core/howto/process.html
>
> I am just using task.LoopingCall(self.__checkForCluster__) instead of
> callLater function. But it’s working I guess.
task.LoopingCall is a little bit sugar that simplifies stuff when you
want to do something every N secs.
But its easy to do manually also:
def foo():
# do stuff
reactor.callLater(1000, foo)
foo()
reactor.run()
Cheers,
/Tobias
>
> Thanks,
> Amitabh Arya
>
>
> On Mar 13, 2014, at 9:58 AM, Tobias Oberstein
> <
tobias.o...@gmail.com <mailto:
tobias.o...@gmail.com>> wrote:
>
>> Am 13.03.2014 14:56, schrieb Amitabh@tech:
>>> But my requirement is to listen port first and 15 mins later connect
>>> to another server. Not one after one but after 15 mins of delay.
>>
>> sure, and that is what the code below does.
>>
>> btw: are you "Chuck" or "Amitabh" or whom I am talking to?
>>
>>
>>>
>>> Thanks,
>>> Amitabh Arya
>>>
>>>
>>>> On Mar 13, 2014, at 9:42 AM, Tobias Oberstein
>>>> <mailto:
autobahnws+...@googlegroups.com>.
>> <mailto:
autobahnws+...@googlegroups.com>.
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
autobahnws+...@googlegroups.com
> <mailto:
autobahnws+...@googlegroups.com>.