Jump to content
Sign in to follow this  
Essbaumer

What's wrong?

Recommended Posts

Hi,

I try to code a simply IRC Client.

This is my first try.

CODE

#include <file.au3>

Global $addr = "irc.freenode.net"

Global $port = "6667"

Global $channel = "#test-channel"

Global $nick = "noname145236"

Global $nick_pw = ""

Global $sock = -1

AutoItSetOption("RunErrorsFatal", 0)

Opt("TCPTimeout",100) ;in ms

TCPStartup()

$ip = TCPNameToIP($addr)

$sock = TCPConnect($ip, $port)

If @error Then

Msgbox(0, "Fehler", "Could not connect to " & $addr & ":" & $port & ".")

Exit

EndIf

$loop = 0

While 1

$irc = TCPRecv($sock, 384)

If @error Then

Exit

EndIf

If $irc <> "" Then

_FileWriteLog(@ScriptDir & "\log_backup.txt", $irc)

EndIf

WEnd

IRC_Send("Blub")

Func IRC_Send($Msg)

Global $sock

TCPSend($sock, $Msg)

EndFunc

A Log File will be created.

Take a look:

CODE

2006-12-23 22:17:04 : NOTICE AUTH : *** Looking up your hostname...

2006-12-23 22:17:05 : NOTICE AUTH : *** Found your hostname, welcome back

NOTICE AUTH : *** Checking ident

2006-12-23 22:17:12 : NOTICE AUTH : *** No identd (auth) response

2006-12-23 22:17:20 : ERROR :Closing Link: 127.0.0.1 (Connection Timed Out)

It looks like fine.

But the IRC Server kicked me.

Why? Where is my Bug?

Greetings,

Ralf

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...