http://www.mycal.net/projects/unetserial/
Has a project that has an interesting AT command set for serial and TCP. I know years ago I used the Ethernet Version of this, but I cannot find a link to that. In the page there is a zip file with all the source code and a pretty interesting document showing how the AT command set works in detail.
In any case it at least might be worth a look
-lp