> 
> My application gets data through a TCPSocket. All the data for example
> is prefixed by a certain command. I would like to have some sort of
> modular support for these commands which means that I can dynamically
> add a certain action for a new command. My guess was that this could
> best be done by loading external files, let the files register some
> command/actionfunction and have some sort of communication between the
> files code and the main app code. The communication is the problem.
> 

Hi!

This reminds me a little of rbot ( http://linuxbrit.co.uk/rbot/ ), a 
ruby irc bot that provides a plugin framework. You can drop files 
('plugins') into a plugin directory, and have this plugins register 
themselves for some commands. Then chatters use these commands when they 
message the bot. For example, the google.rb plugin registers itself 
under 'search', so you can ask in a channel 'rbot search what i want to 
find' and the bot queries google. Of course you still have the IRC 
protocol in between you and the TCPSocket, but the general layout may 
give you some hints.

Hope that helps and was understandable ;)

Henrik