We don't bite newbies here... much | |
PerlMonks |
Re: TCP Server: Beyond echoing requestby haukex (Archbishop) |
on May 25, 2017 at 15:07 UTC ( [id://1191222]=note: print w/replies, xml ) | Need Help?? |
It seems like I should be looking to implement an application layer protocol to transfer data (text) between server and client, but I don't want to invent my own protocol or use one that's more complex than I need. Google searches have not resulted in a definitive answer. Is there an existing protocol I should look into? That really depends on what you want to transfer. It looks like you've already got a basic line-based protocol, which is actually not too uncommon for simple applications, so it's a very good start. But since you say you're doing this to learn, I might suggest that writing your own protocol while reading the specifications of another existing protocol might be best. For example, HTTP/1.0 (RFC 1945) (although it's mostly been superseded by HTTP/1.1 and grown quite complex through all sorts of extensions) can show you the basics of "one way to do it", plus you'll learn a lot about HTTP. Note that if you look at the Session Initiation Protocol (SIP, RFC 3261), one of the basics of VoIP, you'll recognize a very similar message structure as HTTP (one line for the request / response, plus headers, blank line, then content). Based on your example messages, it looks like you're interested in something like IRC, so perhaps a read of some technical information like RFC 1459 would be helpful. For something a bit more modern, see e.g. XMPP. Other classic protocols that are still in wide use today are e.g FTP and SMTP.
In Section
Seekers of Perl Wisdom
|
|