From what I understand telnet is a program that lets you connect to another server on a given port, and then send and receive plan text over a TCP connection. Since the IRC protocol is plain text you can talk to a server "by hand".
Now the issue is that TCP is a stream oriented protcol (its just like reading from a file), you have no idea how many bytes someone has sent you. So you have to build something into your communications protocol to be able tell when messages start in end. In the IRC protocol they want you to put "\r\n" at the end of every message. That is how the server knows you are done sending. Here is an example:
/* Bad */
char p[] = "join #macfilez";
/* Good */
char p[] = "join #macfilez\r\n";