Jump to content

how to request data from IRC protocol ?


Recommended Posts

At first im sorry about my bad English.

I have got code:

Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname

While 1
    Local $run
    local $strtmp
    $recv = TCPRecv($sock, 8192); Recieve things from server
    If @error Then $sock = _IRCConnect($server, $port, $nick); If you can not recieve then the server must have died.
    Local $sData = StringSplit($recv, @CRLF); Splits the messages, sometimes the server groups them
    For $i = 1 To $sData[0] Step 1; Does each message seperately
        Local $sTemp = StringSplit($sData[$i], " "); Splits the message by spaces
        If $sTemp[1] = "" Then ContinueLoop; If its empty, Continue!
        If $sTemp[1] = "PING" Then TCPSend($sock, "PONG " & $sTemp[2] & @CRLF); Checks for PING replys (There smaller then usual messages so its special!
        If $sTemp[0] <= 2 Then ContinueLoop; Useless messages for the most part
        Switch $sTemp[2]; Splits the command msg

I get it from my friend. But i dont understand about statement:

If $sTemp[1] = "PING" Then TCPSend($sock, "PONG " & $sTemp[2] & @CRLF);

Here why can we know $sTemp[1] have got data for "PING" ??? I have read about IRC Protocol and flow-chart but dont get any information about it.I try to use TCPRecv() to recive data from IRC but cant look for data have got statement : "PING". I know PING is a statement that server send to client to request client live or die.But why i cant find it out in data sended from server ?

Can everybody tell me ? Thanks in advance!!

Edited by comeonbaby
Link to comment
Share on other sites

At first im sorry about my bad English.

I have got code:

Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname

While 1
    Local $run
    local $strtmp
    $recv = TCPRecv($sock, 8192); Recieve things from server
    If @error Then $sock = _IRCConnect($server, $port, $nick); If you can not recieve then the server must have died.
    Local $sData = StringSplit($recv, @CRLF); Splits the messages, sometimes the server groups them
    For $i = 1 To $sData[0] Step 1; Does each message seperately
        Local $sTemp = StringSplit($sData[$i], " "); Splits the message by spaces
        If $sTemp[1] = "" Then ContinueLoop; If its empty, Continue!
        If $sTemp[1] = "PING" Then TCPSend($sock, "PONG " & $sTemp[2] & @CRLF); Checks for PING replys (There smaller then usual messages so its special!
        If $sTemp[0] <= 2 Then ContinueLoop; Useless messages for the most part
        Switch $sTemp[2]; Splits the command msg

I get it from my friend. But i dont understand about statement:

If $sTemp[1] = "PING" Then TCPSend($sock, "PONG " & $sTemp[2] & @CRLF);

Here why can we know $sTemp[1] have got data for "PING" ??? I have read about IRC Protocol and flow-chart but dont get any information about it.I try to use TCPRecv() to recive data from IRC but cant look for data have got statement : "PING". I know PING is a statement that server send to client to request client live or die.But why i cant find it out in data sended from server ?

Can everybody tell me ? Thanks in advance!!

Hi there

Reading the code you posted, PING is not a command but a value inside $recv.

$recv is splitted (removing end of lines with carrier) to array $data.

Every element in array $data[$i] is splitted by removing spaces.

Somewhere in those elements the PING statement is there and if it is "PONG" is send to server.

Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname

While 1
    Local $run
    local $strtmp
    $recv = TCPRecv($sock, 8192); Recieve things from server
    If @error Then $sock = _IRCConnect($server, $port, $nick); If you can not recieve then the server must have died.
    Local $sData = StringSplit($recv, @CRLF); Splits the messages, sometimes the server groups them
    For $i = 1 To $sData[0] Step 1; Does each message seperately
        Local $sTemp = StringSplit($sData[$i], " "); Splits the message by spaces
        If $sTemp[1] = "" Then ContinueLoop; If its empty, Continue!
        If $sTemp[1] = "PING" Then $iSend = TCPSend($sock, "PONG " & $sTemp[2] & @CRLF); Checks for PING replys (There smaller then usual messages so its special!
            if $iSend > 0 then MsgBox(0, "Send Result", "Success", 4)
            Else
                MsgBox(0, "Send Result", "Failure", 4)
                ContinueLoop
            EndIf
        If $sTemp[0] <= 2 Then ContinueLoop; Useless messages for the most part
        Switch $sTemp[2]; Splits the command msg
...

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Yes i know about how to split it. But server ping for 180 seconds and close connect. And for 180 seconds i recieve data from server AND cant look for any text have got : "PING" . So why that statement able to check its avaiable ?

And here is data i get from server :

:IRC.VIETIRC.COM 001 Slave_BQXWSOXL :Welcome to VIET IRC NETWORK Slave_BQXWSOXL!Slave_BQXW@118.71.170.120

:IRC.VIETIRC.COM 002 Slave_BQXWSOXL

:Your host is IRC.VIETIRC.COM[@0.0.0.0], running UltimateIRCd(Tsunami)-3.0(00).rc3

:IRC.VIETIRC.COM 003 Slave_BQXWSOXL :This server was last (re)started on Sat Sep 6 2008 at 01:23:19 PDT and is located San Diego, California USA

:IRC.VIETIRC.COM 004 Slave_BQXWSOXL IRC.VIETIRC.COM UltimateIRCd(Tsunami)-3.0(00).rc3 adhioprxDOPRSWZ acehimnopqstvAKMNORS

:IRC.VIETIRC.COM 005 Slave_BQXWSOXL SAFELIST SILENCE KNOCK FNC WATCH=128 CHANLIMIT=#&:20 MAXLIST=be:60 NICKLEN=18 TOPICLEN=307 KICKLEN=307 CHANNELLEN=32 :are available on this server

:IRC.VIETIRC.COM 005 Slave_BQXWSOXL EXCEPTS=e CHANTYPES=#& PREFIX=(aohv)!@%+ CHANMODES=be,k,l,cimnpqstAKMNORS STATUSMSG=!@%+ NETWORK=VietIRC CASEMAPPING=ascii STD=i-d :are available on this server

:IRC.VIETIRC.COM 251 Slave_BQXWSOXL :There are 0 users and 95 invisible on 3 servers:IRC.VIETIRC.COM 252 Slave_BQXWSOXL 19

:IRC Operators online:IRC.VIETIRC.COM 254 Slave_BQXWSOXL 181 :channels formed

:IRC.VIETIRC.COM 255 Slave_BQXWSOXL :I have 92 clients and 1 servers:IRC.VIETIRC.COM 265 Slave_BQXWSOXL

:Current local users: 92 Max: 708

:IRC.VIETIRC.COM 266 Slave_BQXWSOXL

:Current global users: 95 Max: 708

:IRC.VIETIRC.COM 375 Slave_BQXWSOXL

:- IRC.VIETIRC.COM Message of the Day -

:IRC.VIETIRC.COM 372 Slave_BQXWSOXL

:- 27/11/2008 3:02

:IRC.VIETIRC.COM 372 Slave_BQXWSOXL :- This is UltimateIRCd MOTD replace it with something better.

:IRC.VIETIRC.COM 376 Slave_BQXWSOXL :End of /MOTD.:Slave_BQXWSOXL MODE Slave_BQXWSOXL :+ix

:Slave_BQXWSOXL!Slave_BQXW@118.71.170.50749 JOIN :#VIETNAM

:IRC.VIETIRC.COM 332 Slave_BQXWSOXL #VIETNAM :0,7Cac ban muon dang ky nick name thi go~ /msg NickServ Register Password Email 0,3va

sau do kiem tra email de nhan code kich hoat. va lam theo huong dan 0,4Luu y

: Email phai la email that neu ko se ko ket thuc viec dang ky nick name cua ban.1,8 /Join #DANGKY de biet them chi tiet

:IRC.VIETIRC.COM 333 Slave_BQXWSOXL #VIETNAM zZBoomZz 1226186978:IRC.VIETIRC.COM 353 Slave_BQXWSOXL = #VIETNAM

:Slave_BQXWSOXL lamduyen BigBang @TanKiem Guest007615539 anhchang_7tinh zZBoomZz RongXanh Quoc_Minh EmXinhEmKiu_EmHokI caubexitrum Vi`Sao ThanDieu_Buon AnGiangChat ThanDieu_CongTu AnhDung TuanAnh ThanDieu_DaiHiep LUDAmala BoGiaCocSe Batigol @Thuy_AnCH @NoLove DolLa be_mi Khach7067964 tItHaI @ChanTinh @ChuBi Thieugai emsemaichoanh32 AngelHell boylangthang_vt nOnick Quocdi CuOc-ChOi-Vo-NgHiA HOANGBAOLONG @beginthewarCH LangTuDaTinh anhnhatrang222 :IRC.VIETIRC.COM 353 Slave_BQXWSOXL = #VIETNAM :nKt JACKY no111 GiotSuong boymuonboyvtlt b-y-a-l PhuDuTrang nCt QuocVuong PhieuLang PeNgangTan tEthiEn @CIA TinhKhong NyPua TimEm_AnhTimMAi @CongChua_LoLem vitieubao @PopbYCH nr Mauritius MinhTriVNN MrZing Bo NhauLangThang vodanh BuO^`n khach123456 Guardian dvn-aw Hesman @ThaiNgocCH {cheer} PhC @Services {e-e} chomayxuong KoSoVo langtu_hoanghon :IRC.VIETIRC.COM 366 Slave_BQXWSOXL #VIETNAM :End of /NAMES list.

:Slave_BQXWSOXL!Slave_BQXW@118.71.170.50749 JOIN :#CB

:IRC.VIETIRC.COM 353 Slave_BQXWSOXL = #CB :Slave_BQXWSOXL @comeonbaby

:IRC.VIETIRC.COM 366 Slave_BQXWSOXL #CB :End of /NAMES list.

:Global!services@services.vietirc.com NOTICE Slave_BQXWSOXL :[Logon News - Sep 10 2008] 11,1Welcome to VietIRC NetWork!!! 4,1Chu'c cac ban co thoi gian vui ve tai day. Room chat chi'nh cua Server:7 #VIETNAM 11,1 Ban ca^n` su giup do~ 8/join #HELP,#support 11hoac go~ 9/STAFF 11de ti`m IRCOP online giup do~!

:Global!services@services.vietirc.com NOTICE Slave_BQXWSOXL :[Random News - Sep 10 2008] 0,12WELCOME TO VIETNAMESE SERVER CHAT - /SERVER IRC.VIETIRC.COM & IRC.DATVIET.NET - VIETIRC NETWORK !!! 0,12HAVE A NICE DAY, JUST RELAXING, CHATTING AND FIND OUT SOMETHING ABT MIRC&VIETIRC.0,12 IF YOU NEED ANY ASSISTANTS JUST DO 0,6/STAFF 0,12TO CHECK IRCOPS ARE ONLINE AND AVAILABLE OR DO 0,4/JOIN #SUPPORT,#HELP 0,12TO BE HELPED CLEARLY!

:lamduyen!whUbOLq9n@216.186.133.63699 NICK :emmai_codon:emmai_codon!whUbOLq9n@216.186.133.63699 PRIVMSG #vietnam :FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!FlooD ne` admin!!!!!:BigBang!whUbOLq9n@216.186.133.63699 QUIT

:BigBang:emmai_codon!whUbOLq9n@216.186.133.63699 QUIT

:emmai_codon:Yeuemnheanh20!hoasua@IP-53373.hsd1.nh.comcast.net JOIN :#VIETNAM

:Yeuemnheanh20!hoasua@IP-53373.hsd1.nh.comcast.net QUIT :Killed (services.vietirc.com (Cloning [1]))

:coy`!bichnga@203.162.3.42731 JOIN :#VIETNAM

:Night_Dream!hotdumtamo@IP-43189.static.optonline.net JOIN :#VIETNAM

:Night_Dream!hotdumtamo@IP-43189.static.optonline.net NICK :Hoacuctim1

Link to comment
Share on other sites

I see...

And you are sure that the script works with you friend?

Maybe the PING statement is not in that broadcast.

An idea, copy all data to a txt file for a while (at least 180 secs) and then try to find PING.

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Great :)

Be pacience my friend o:):)

Any time, cheers!!

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...