Jump to content

Recommended Posts

Posted (edited)

Alright, I've written two small, really basic scripts for server/client that will allow up to 100 concurrent sockets/connections.

I've searched, I've read the threads.. I don't see what I'm doing wrong. I'm TCPAccepting all connections to an array, etc, etc. However, I'm never able to connect to the server. What mistake am I making? Every time the connection I attempt to make to my server will immediately return -1.

Anyway, here are the scripts:

Client:

#include <GuiConstantsEx.au3>

$hClient = GUICreate("TCP Client", 387, 105, 260, 281)
$oSend = GUICtrlCreateButton("Send", 256, 64, 89, 25, 0)
$oInput = GUICtrlCreateInput("", 32, 64, 217, 21)
$oConnect = GUICtrlCreateButton("Connect", 32, 16, 105, 33, 0)
$oDisconnect = GUICtrlCreateButton("Disconnect", 144, 16, 105, 33, 0)
GUISetState(@SW_SHOW, $hClient)

Global $oSocket = -1

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $oConnect
            _OpenSocket()
        Case $oDisconnect
            _CloseSocket()
        Case $oSend
            _SendData()
        Case $oInput
            _SendData()
    EndSwitch
WEnd

Func _SendData()
    If $oSocket <> -1 Then
        TCPSend($oSocket, GUICtrlRead($oInput))
    Else
        MsgBox(0, "Error", "You must be connected first!")
    EndIf
EndFunc   ;==>_SendData

Func _CloseSocket()
    If $oSocket <> -1 Then
    TCPCloseSocket($oSocket)
Else
    MsgBox(0, "Error", "Socket is already disconnected!")
    EndIf
EndFunc   ;==>_CloseSocket

Func _OpenSocket()
    If $oSocket <> -1 Then
        MsgBox(0, "Error", "You are already connected!")
    Else
        $oSocket = TCPConnect("127.0.0.1", "2001")
        If $oSocket = -1 Then
            MsgBox(0, "Error", "Can not connect to server!"&@CR&"@Error = "&@Error)
        Else
        TCPSend($oSocket, "You are connected to the server!")
        EndIf
    EndIf
EndFunc   ;==>_OpenSocketoÝ÷ Ø   ÝIêïz¶®¶­sdvÆö&Âb33c¶7W'&VçE6ö6¶WBÒÂb33c¶ôÆ7FVå6ö6¶WBÂb33c¶ô6öææV7FVE6ö6¶WE³Ð ¥õD57F'E6W'fW" ¥vÆR b33c¶ô6öææV7FVE6ö6¶WE²b33c¶7W'&VçE6ö6¶WEÒÒD566WBb33c¶ôÆ7FVå6ö6¶WB 6öç6öÆUw&FRb33c¶ô6öææV7FVE6ö6¶WE²b33c¶7W'&VçE6ö6¶WEÒf×´5" bb33c¶ô6öææV7FVE6ö6¶WE²b33c¶7W'&VçE6ö6¶WEÒfÇC²fwC²ÓFVà ×6t&÷ÂgV÷CµD5gV÷C²ÂgV÷C´6ÆVçB6öææV7FVBöâ6ö6¶WB2gV÷C²fײb33c¶7W'&VçE6ö6¶WB b33c¶7W'&VçE6ö6¶WBÒb33c¶7W'&VçE6ö6¶WB² VæD` f÷"b33c¶ÒFò bb33c¶ô6öææV7FVE6ö6¶WE²b33c¶ÒfÇC²fwC²Ó÷"b33c¶ô6öææV7FVE6ö6¶WE²b33c¶ÒfÇC²fwC²gV÷C²gV÷C²FVà b33c·5&W7bÒD5&V7bb33c¶ô6öææV7FVE6ö6¶WE²b33c¶ÒÂS bb33c·5&W7bfÇC²fwC²gV÷C²gV÷C²FVâ×6t&÷ÂgV÷CµD5gV÷C²ÂgV÷C´FF&V6VfVBg&öÒ6ö6¶WB3¢gV÷C²fײb33c¶fײ5"fײgV÷C´FF¢gV÷C²fײb33c·5&W7b VæD` æW@ 6ÆVW#¥tVæ@ ¤gVæ2õD57F'E6W'fW" Æö6Âb33c·5&W7VÇ@  b33c·5&W7VÇBÒD57F'GW bb33c·5&W7VÇBÒFVà ×6t&÷ÂgV÷C´W'&÷"gV÷C²ÂgV÷CµVæ&ÆRFò7F'GWD56W'f6W2b333²gV÷C² W@ VæD` b33c¶ôÆ7FVå6ö6¶WBÒD5Æ7FVâgV÷C³#rãããgV÷C²ÂgV÷C³#gV÷C²ÂgV÷C³gV÷C² bb33c¶ôÆ7FVå6ö6¶WBÒÓFVà ×6t&÷ÂgV÷C´W'&÷"gV÷C²ÂgV÷CµVæ&ÆRFò7F'BÆ7FVææröâ÷'B#gV÷C² W@ VæD`¤VæDgVæ2³ÓÒfwCµõD57F'E6W'fW

This is more of a proof of concept for myself so if I can keep the structure as close to what it is now it would be better.

Thank you and I look forward to hearing any comments people have.

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Posted

Solved this myself.

I had no TCPStartup() in my client, stupid mistake. Sorry for the post.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

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
  • Recently Browsing   0 members

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