Custom server

[email protected] (Mark Richards) Sun, 09 Dec 2012 16:15:08 -0500
Newsgroups perl.poe
Message-ID <[email protected]>
--------------050804060802000309090905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I think POE would be a good choice for what I am about to describe, but 
there are a few bits I am not certain about (how to implement; whether 
it's possible to implement).

I already have a working model of a server that listens on a designated 
port (built in php!). It forks each connection request and handles these 
independently.  There may be one or 100 clients connecting at any time.  
However there is the problem of zombies, and the lack of centralized 
control and reporting.  I want to build this in perl, and feel POE would 
be a good choice.

My server waits for a connection.  The client, once connected, sends a 
header that contains its ID and WAN IP address.  The server reads this, 
and responds by either continuing some communications with the client, 
or dropping the connection if it is not validated.

A valid connection provides a MODBUS ASCII session with a MODBUS network 
attached to the client.  So the server instance sends some MODBUS 
commands and gets data in response.  In the present implementation the 
server keeps the connection alive for 10 minutes (this is a design 
requirement - don't ask!), and then drops the connection (this is where 
we get the zombies from).

What I need POE to do is the same thing, but for this I think I need a 
manager of some kind that will, based on the state of the exchange, 
dispatch the proper request.  Each remote may require a different set of 
requests, which further complicates things.

I've thrown together a simple POE version of my server.  It simply 
accepts the connection and reads in the first data from the client (a 
header).  What's missing is a way to dispatch requests dynamically and 
also to wait without making the whole POE instance wait.

Hoping I have described this adequately, and that the experienced out 
there might offer some suggestions as to how to approach this - and 
whether POE is the right move.

Thanks!


--------------050804060802000309090905--