IRC-Client funktioniert nicht. Ping-Timeout

Übersicht BlitzMax, BlitzMax NG Allgemein

Neue Antwort erstellen

BtbN

Betreff: IRC-Client funktioniert nicht. Ping-Timeout

BeitragMi, Jan 04, 2006 14:01
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
SuperStrict

Framework BRL.MaxGUI
?win32
Import BRL.Win32MaxGUI
?linux
Import BRL.FLTKMaxGUI
?mac
Import BRL.CocoaMaxGUI
?
Import BtbN.EasyTCP
Import BRL.Retro


Global Window:TGadget = CreateWindow("MaxIRC",50,50,800,600,Null,WINDOW_TITLEBAR|WINDOW_MENU|WINDOW_RESIZABLE)

Global TextOut:TGadget = CreateTextArea(5,5,790,530,Window)
SetGadgetLayout(TextOut,EDGE_RELATIVE,EDGE_RELATIVE,EDGE_RELATIVE,EDGE_RELATIVE)

Global TextIn:TGadget = CreateTextField(5,540,720,25,Window)
SetGadgetLayout(TextIn,EDGE_RELATIVE,EDGE_RELATIVE,EDGE_RELATIVE,EDGE_RELATIVE)

Global TextOk:TGadget = CreateButton("Senden",730,540,65,25,Window,BUTTON_OK)
SetGadgetLayout(TextOk,EDGE_RELATIVE,EDGE_RELATIVE,EDGE_RELATIVE,EDGE_RELATIVE)

Global temps:String

Global TCPStream:TTCPStream = OpenTCPStream("irc.euirc.net",6667)
WriteLine(TCPStream,"USER Born 127.0.0.1 irc.euirc.net NoName ")
WriteLine(TCPStream,"NICK Born")
WriteLine(TCPStream,"PONG")


Repeat

   Select PollEvent()
      Case EVENT_WINDOWCLOSE
         Exit
      Case EVENT_GADGETACTION
         Select EventSource()
            Case TextOk
               ActivateGadget(TextIn)
               WriteLine(TCPStream,TextFieldText(TextIn))
               SetGadgetText(TextIn,"")
         EndSelect
      Case EVENT_APPTERMINATE
         Exit
   EndSelect

   Update()

Forever

WriteLine(TCPStream,"QUIT")
CloseTCPStream(TCPStream)

End


Function Update()
   If TCPStream.ReadAvail() Then
      temps = ReadLine(TCPStream)
      If temps[0..4] = "PING" Then
         WriteLine(TCPStream,temps.Replace("PING :","PONG "))
         DebugLog " "+temps
         DebugLog " "+temps.Replace("PING :","PONG ")
         AddTextAreaText(TextOut,"Ping? Pong!~n")
      Else
         AddTextAreaText(TextOut,temps+"~n")
      EndIf
   EndIf
EndFunction



Es kommt immer ein Ping-Timeout, obwohl ich den PONG gesendet habe, und ich finde nicht raus, wieso.
Sieht hier jemand mehr wie ich?

rema

BeitragMi, Jan 04, 2006 14:32
Antworten mit Zitat
Benutzer-Profile anzeigen
Schau mal hier hast du einen guten IRC-Client als Vorlage, nur in BB geschrieben:

http://www.blitzbasic.com/code...p?code=611

// Edit //

1) Verbindungsaufbau
2) IRC-Channel beziehn
3) Einloggen

Schau mal unter der Function: Start_Network und Join_Channel !!!

Jolinah

BeitragMi, Jan 04, 2006 15:53
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich glaube das PING hat nur beim ersten mal ein Doppelpunkt mit ner Zahl dahinter, danach kommt nur noch PING

Code: [AUSKLAPPEN]
PING :38172  => "PONG 38172"
PING  => "PONG"
PING  => "PONG"
usw.


Das würde zumindest das Timeout erklären, weil dann dein Replace nicht mehr funktioniert Wink

BtbN

BeitragDo, Jan 05, 2006 14:21
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
Function Update()
   If TCPStream.ReadAvail() Then
      temps = ReadLine(TCPStream)
      If temps[0..4] = "PING" Then
         WriteLine(TCPStream,temps.Replace("PING","PONG").Replace(":",""))
         DebugLog " "+temps
         DebugLog " "+temps.Replace("PING","PONG").Replace(":","")
         AddTextAreaText(TextOut,"Ping? Pong!~n")
      Else
         AddTextAreaText(TextOut,temps+"~n")
      EndIf
   EndIf
EndFunction


Damit gehts, danke für den Tip.

Neue Antwort erstellen


Übersicht BlitzMax, BlitzMax NG Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group