Maybe you've got a good reason, but in general I would be wary of reading and 
writing files in a PacketIn handler.

-- Murphy

On Nov 19, 2014, at 12:34 PM, Lucas Brasilino <lr...@cin.ufpe.br> wrote:

> Hi!
> 
>> hello everybody
>> i am working with pox as my controller for mininet topology. in my pox cod
>> in the def _handle_PacketIn, i call function for send port_stats_request, 2
>> times within 5 minutes. also i writhed def _handle_portstats_received(event)
>> , for handle portsatsrecieved event, so that , i call this function as
>> core.openflow.addListenerByName("PortStatsReceived",
>> _handle_portstats_received) in the def launch (). in the def
>> _handle_portstats_received(event) , i open a text file (with
>> open('Portstats.txt', 'a') as f) and i save info to it, then i want use the
>> this text file( with open('Portstats.txt', 'r') as f) in the def
>> _handle_PacketIn,But I am faced with a problem.  when i run this command
>> (with open('Portstats.txt', 'r') as f) i have one error: This directory does
>> not exist. after this error,  def _handle_portstats_received(event) create
>> portstats.txt, now my question is , how i can write a bet before this
>> command(with open('Portstats.txt', 'r') as f) , that, when this text created
>> , then run this command?
> 
> Seems, if I understood correctly, that another PacketIn event is being
> fired before the response
> of the port_stats_request() call arrive (which raises a
> PortStatusReceived event).
> 
> I don't know your application, but can you just ignore the file
> openning until it has being created ?
> 
> By the way, are you using the Pox Timer API to send the port stat
> requests? If not, I suggest you to do so.
> 
> 
> -- 
> Att
> Lucas Brasilino
> MSc Student @ Federal University of Pernambuco (UFPE) / Brazil
> twitter: @lucas_brasilino
> 
> 
>> def _handle_PacketIn(event):
>>    send request for port stats 2 time within 5 minc
>>    ?????? i want to write a bet here
>>     with open('Portstats.txt', 'r') as f:
>>            # do somthing
>> 
>> 
>> def _handle_portstats_received(event):
>>      with open('Portstats.txt', 'a') as f:
>>            # do somthing
>> 
>> 
>> def launch ():
>>     core.openflow.addListenerByName("PortStatsReceived",
>> _handle_portstats_received)
>> 
>> please help me for solve this problem, thanks

Reply via email to