Sign in to follow this  
Followers 0
DarkAngelBGE

Problem with TCPSend...wont send anything

3 posts in this topic

hi all..made myself a little prog that connects to an irc channel. It logs on to the channel uccessfully, but simply won't "talk" to me with the TCPSend function.

here is the source. Thanks in advance.

;Tim Koschützki


;;break(0);disllow close from the tasktray
;; Comment this out to prevent hotkey exit
Opt("TrayIconHide", 1)  
$server = "irc.quakenet.org"
$port = 6667
$name = "Keylogger_very_mean"
$ident = "rtgyrgtdyd"
$realname = "asdhlkj aklbalkbdls"
$chan = "#jkbub"
Global $user32 = DllOpen ( "user32" )
$debug =0

Opt("TCPTimeout", 100)
Opt("WinTitleMatchMode", 3)

$irc = -1
If TCPStartup() == 0 Then
  MsgBox(0, "TCPStartup Error", "Failed to initialize TCP, make sure you have the TCP/UDP driver installed.  Error code: " & @error)
  Exit
EndIf

$irc = TCPConnect(TCPNameToIP($server), $port)
If $irc == -1 Then
  MsgBox(0, "TCPConnect Error", "Failed to connect to server.  Error code: " & @error)
  Exit
EndIf
 
Func OnAutoItExit()
  If $irc <> -1 Then
    xTCPSend($irc, "QUIT : Shutting down..." & @CRLF)
    TCPCloseSocket($irc)
    TCPShutdown()
  EndIf
EndFunc

Func HandlePing($irc, $buff)
  $x = $buff
  While not StringInStr($x, @CR)
    Sleep(100)
    $x = $x & xTCPRecv($irc, 512)

    If ($x == "") Then
      Return 0
    EndIf
  WEnd
  $type = HandleMessage($irc, StringLeft($x, StringInStr($x, @CR) - 1))
  if $type == "PING" or $type == "376" Then
    Return 1
  EndIf
  
  Return HandlePing($irc, StringRight($x, StringLen($x) - StringInStr($x, @CR) - 1))
EndFunc

Func HandleMessage($irc, $text)
  $text = StringSplit($text, " ")
  If $text[1] == "PING" Then
    xTCPSend($irc, "PONG " & $text[2] & @CRLF)
    Return "PING"
  ElseIf StringLeft($text[1], 1) == ":" Then
    Return $text[2]
  EndIf
EndFunc

Func xTCPSend($irc, $text)
  If $debug == 1 Then
    MsgBox(0, "TCPSend", $text)
  EndIf
  Return TCPSend($irc, $text)
EndFunc

Func xTCPRecv($irc, $lim)
  $x = TCPRecv($irc, $lim)
  If $x <> "" and $debug == 1 Then
    MsgBox(0, "TCPRecv", $x)
  EndIf
  Return $x
EndFunc


xTCPSend($irc, "USER " & $ident & " 0 * :" & $realname & @CRLF)
xTCPSend($irc, "NICK " & $name & @CRLF)

While (HandlePing($irc, "") == 0)
  Sleep(100)
WEnd

xTCPSend($irc, "JOIN " & $chan & @CRLF)

xTCPSend($irc, "Hi am here"); **

It will never send "Hi am here", although I am staying in the same channel with mIRC.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

This topic would have received much better response if it were posted in the correct forum, "v3 Support". I would ask a moderator to move this post for you.

Edit: That was fast :)

Edited by neogia

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

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  
Followers 0