Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cocoa IRC (Ping Pong)

Cocoa IRC (Ping Pong)
Thread Tools
Syphor
Junior Member
Join Date: Jul 2002
Location: Australia
Status: Offline
Reply With Quote
Aug 27, 2002, 07:53 PM
 
Hi all, This is Syphor here again Can anyone explain to me how the IRC PONG system works?? I know when ther server PINGs? the client, the client is suppose to reply with a PONG. I have made a small basic cocoa app that connects to the specified irc server using small sockets and displays it in a NSTextView, but I can't figure out how to PONG the server... because after 30seconds it disconnects me from a ping timeout.

I tried something like this

Code:
[socket writeString:@"PONG :irc.dal.net"];
Though it doesn't work

Has anyone had any luck with this?
     
Camelot
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Aug 31, 2002, 10:00 PM
 
Originally posted by Syphor:

I tried something like this

Code:
[socket writeString:@"PONG :irc.dal.net"];
Remove the :

PONG irc.dal.net

(or whatever servername PINGed you) is the correct response.

According to the RFC:

The presence of a prefix is indicated with a single leading ASCII
colon character (':', 0x3b), which must be the first character of the
message itself. There must be no gap (whitespace) between the colon
and the prefix. The prefix is used by servers to indicate the true
origin of the message. If the prefix is missing from the message, it
is assumed to have originated from the connection from which it was
received. Clients should not use prefix when sending a message from
themselves; if they use a prefix, the only valid prefix is the
registered nickname associated with the client. If the source
identified by the prefix cannot be found from the server's internal
database, or if the source is registered from a different link than
from which the message arrived, the server must ignore the message
silently.
In other words, the ':' marks the prefix for the command, and the only valid prefix for a client is the nickname you're using.
     
Syphor  (op)
Junior Member
Join Date: Jul 2002
Location: Australia
Status: Offline
Reply With Quote
Aug 31, 2002, 11:36 PM
 
So if my nickname/username/realname is "Syphor" i should just reply to the server PINGs with "PONG : Syphor"??
     
amonitzer
Forum Regular
Join Date: Aug 2001
Location: Vienna, Austria
Status: Offline
Reply With Quote
Sep 1, 2002, 06:12 AM
 
Appending \r\n would be a good idea too:
Code:
[socket writeString:@"PONG irc.dal.net\r\n"];
     
Camelot
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Sep 1, 2002, 06:02 PM
 
Originally posted by Syphor:
So if my nickname/username/realname is "Syphor" i should just reply to the server PINGs with "PONG : Syphor"??
No, you reply with the name of the server that PINGed you:

PONG irc.dal.net

You do NOT need the ':' at all. If you do include the ":" the next field must be the nickname that your connection is using:

PONG :myNick irc.dal.net

but the nickname (and therefore the :)is not needed.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:25 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,