P is for Practical | |
PerlMonks |
creating a state machineby particle (Vicar) |
on Mar 11, 2003 at 22:43 UTC ( [id://242182]=perlquestion: print w/replies, xml ) | Need Help?? |
particle has asked for the wisdom of the Perl Monks concerning the following question: i'm trying to put together a proxy between the server end of a client/server application, and a code repository. the repository is on win32, the server on solaris. i thought i'd write a sockets-based app that would handle communications with a protocol somewhat like SMTP. you'll find some of the design details below. the design is basically complete, although i haven't included all the info below. now it's time for the implementation... which is where i'm stuck. i have a functioning sockets client/server pair (that's the easy part.) i don't have gobs of time to get this implemented -- i'd like to have it finished this week. i know there are modules like POE and DFA, but i'm not at all familiar with them. is there some sample code out there i can model this after, or could someone please provide some? i just need a kickstart and i'm sure i can handle the rest. thanks in advance. now, for the details. there are six basic operations the server can perform:
five of the commands (HELLO, GET, UNL, PUT, EXIT) have a similar state diagrams. here, B is 'begin', W is 'wait', S is 'success', and F is 'failure'. success returns 'OK', failure returns a detailed error message.
the DATA command is a bit different, as shown in it's diagram below.
did i mention it's a bit like SMTP? here the DATA command is sent, followed by multiple lines of data, and a terminator. a success or failure message is generated. please let me know if you need any more detail, or clarification. ~Particle *accelerates*
Back to
Seekers of Perl Wisdom
|
|