Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

irc via telnet, how to auto-pong?

Name: Anonymous 2008-02-02 13:23

Hello.

I'm using irc via telnet to learn more about the raw protocol. Everything runs smoothly except one thing that I find annoying. I need to reply to ping with pong <message from ping> every time the server requests it, otherwise it will disconnect me (ping timeout). Because of this I can't idle out and need to pay attention to ping requests. I'm trying to find some way to still use telnet normally only to make those pong replies more automatic so I can do something else. I tried googling and asking around on irc channels, but to no success so far. Any ideas? I'm connecting from a *nix server.

Name: Anonymous 2008-02-03 0:52

>>12

You can stick your "truth" up your ass.

>>13
I'm an amateur Sunday "programmer", not trying to look like anything more or less.

If asking about such a thing in OP looks dumb to must of you sorry for posting such a question.

Anyway, what I wrote so far is:


#!/usr/bin/perl

use IO::Socket;

$sock = IO::Socket::INET->new(
    PeerAddr => 'localhost',
    PeerPort => 6667,
    Proto => 'tcp') or die "could not establish connection";

while ($line = <$sock>) {
    print $line;
    if ($line =~ /^PING/) {
        print $sock "PONG :" . (split(/ :/, $line))[1];
    }
    $command = <>;
    print $sock $command;
}


It's almost what I wanted but I need to press return every time to see the next line the server spews out.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List