Hi all,
I am trying to design a ryu module that plays as a permanent server to exchange
data with a external web. After receiving some data, I would like to let this
module to send RYU events to other modules as notification. Now I am stuck in
that because although I successfully built the server and can receive
information from web client, I am not able to communicate with other RYU
applications.
class MyTCPHandler(SocketServer.BaseRequestHandler,app_manager.RyuApp):
"""
The RequestHandler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""
def __init__(self, *args, **kwargs):
"""Call the base RyuApp __init__"""
app_manager.RyuApp.__init__(self,*args, **kwargs)
SocketServer.BaseRequestHandler.__init__(self,*args, **kwargs)
def handle(self):
# self.request is the TCP socket connected to the client
self.data = self.request.recv(1024).strip()
#print "{} wrote:".format(self.client_address[0])
print "Receive from web portal"
print self.data
time.sleep(5)
ev = custom_event.RequestEvent()
ev.src = None
ev.dst = 'ManagerRole'
ev.sync = True
ev.reply_q = None
print 'Sent event request and wait reply'
self.send_request(ev)
print 'I got reply'
self.request.sendall('Yes, I send you back')
HOST, PORT = "192.168.56.101", 6633
print 'start server'
### Create the server, binding to localhost on port 9999
server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
### Activate the server; this will keep running until you
### interrupt the program with Ctrl-C
server.serve_forever()
##threading.Thread(target=server.serve_forever).start()
And here is what I received if the client sends a string 'Hello'
loading app ryu/OS/no.py
start server
Receive from web portal
Hello
Sent event request and wait reply
It is apparent that the information: instantiating app ryu/OS/no.py of
MyTCPHandler is missing so I guess the RYU does not load the class at all. It
maybe related to that the TCP server thread blocks the RYU thread? Can anyone
help me on that?
Thanks.
Weiyang
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel