View Single Post
Old Mar 3rd, 2008, 8:59 PM   #9
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Re: Simple BSD Sockets Problem

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:
c Syntax (Toggle Plain Text)
  1. /* Bad */
  2. char p[] = "join #macfilez";
  3. /* Good */
  4. char p[] = "join #macfilez\r\n";
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote