Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: TCP Server: Beyond echoing request

by haukex (Bishop)
on May 25, 2017 at 15:07 UTC ( #1191222=note: print w/replies, xml ) Need Help??


in reply to TCP Server: Beyond echoing request

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1191222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2021-04-21 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?