As for whether Codea code itself could act as a server, I guess that depends what kind of server you mean. Certainly it has LuaSocket, so your code can respond to incoming messages. I imagine that building a full-blown html server would be a bit more involved though
Yes I have actually with my friend programmed a simple protocol over the internet with a server, with Codea as the client. LuaSocket is very versatile, and sockets can communicate with each other across languages (ie the game may be written in Lua, the server in Java).