It's impossible to follow exactly what's going on from the snippets you're posting I'm afraid.

Is the code part of a commercial project or is it something you'd just rather not get out into the wider world?

If not, then my suggestion is ZIP it ALL up (and I mean everything, server, client, everything) and either attach it here or if you don't want it to be public, mail it to me (athena at pascalgamedevelopment dot com) and I'll take a look at it.