Cuz once the port is open, you can keep sending as long as you like... and
close it only when done.  That's the way ports work.  Of course, the way
this now stands there's no really safe closing taking place... but you can
put that in later when you /QUIT IRC or whatever.

Re ping/pong... you'll see them coming at you with this program.. if it
stays alive long enough... and you can figure how to parse them and respond.

I've done a whole IRC client in REBOL, but not in position to release it in
total.  It was quite a while ago, so I need lots of head scratching to go
back and figure things out... but will help if you're REALLY stuck.

Russ

PS: Here's the section of my code that does the PONG... but you'll have to
infer what 'p is.. and how I parsed it from the PING message received from
server (you can ignore my debug and logging mode lines):

            if (find/case first p "PING") [     ; system PING (reply with PONG)
              if debug [ foreach item p [prin item]  prin newline ]
              insert irc rejoin["PONG " second p newline]
              if debug [ print rejoin["PONG " second p newline] ]
              if logging [ append log rejoin["PONG " second p newline] ]
 

---------
At 12:26 PM 9/8/2000 -0500, you wrote:
>This helps greatly.  Now i need to master pong response to server pings.  Im
>curious why you didnt have to close the port every time you made a send.
>
>Paul Tretter
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Friday, September 08, 2000 12:02 PM
>To: [EMAIL PROTECTED]
>Subject: [REBOL] I give up Re:
>
>
>Perhaps the following (keeping as close to your code as possible) will
>help... it's very basic but at least you see responses from the IRC server,
>on the basis of which you'll be able to add more to do what you desire.
>
>REBOL[]
>
>size: 10000
>b: make string! size
>
>irc-port: [
>       scheme: 'tcp
>       host: "us.dal.net"
>       port-id: 7000
>]
>
>port: open irc-port
>
>insert port "NICK tret^/"
>insert port "USER tret rebol.dyndns.org irc.mindspring.com tret^/"
>insert port "JOIN #REBOLGODS^/"
>insert port "WHOIS tret^/"
>
>forever  [
>  if 0 < length? b [print b clear b]   ; display replies and clear buffer
>  read-io port b size                  ; get next replies from server
>]
>
>; use ESC to stop program and then manually enter "close port"
>; or just wait for port to time out and close itself on error
>
>
>Russ
>
>----
>At 09:46 AM 9/8/2000 -0500, you wrote:
>>I cant figure it out - doc after doc port after port - its killin me.
>>
>>How do you join an irc channel?  I did the open port stuff I can do it with
>>telnet but not with REBOL.  Look at my script below and tell me whats
>wrong.
>>I understand I havent accounted for everything that IRC RFC states but
>>should I think have enough to contact the server and join the channel but
>>doesnt work.
>>
>>Any ideas?
>>
>>Paul Tretter
>>
>>------------------------------------------
>>
>>
>>REBOL[]
>>
>>irc-port: open/direct/string/no-wait [
>>      scheme: 'tcp
>>      host: "irc.mindspring.com"
>>      port-id: 6667
>>]
>>while [data: copy irc-port] [prin data]
>>insert irc-port "NICK tret^/"
>>close irc-port
>>irc-port: open/direct/string/no-wait [
>>      scheme: 'tcp
>>      host: "irc.mindspring.com"
>>      port-id: 6667
>>]
>>
>>insert irc-port "USER tret rebol.dyndns.org irc.mindspring.com tret^/"
>>close irc-port
>>irc-port: open/direct/string/no-wait [
>>      scheme: 'tcp
>>      host: "irc.mindspring.com"
>>      port-id: 6667
>>]
>>
>>insert irc-port reform "JOIN #REBOLGODS^/"
>>close irc-port
>>
>>
>>
>>
>
>
>

Reply via email to