Jump to content

Lagging when using TCP


Recommended Posts

  • Moderators

So always when i try to connect somewhere with TCP, my computer starts lagging, and then the program with TCP is not responding anymore. Where is the problem?

Replace line 16 with
$myCode = "If I showed code, I would probably get an answer I understood"

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi, I'm Mike Rowe, and THIS is my job...

Replace line 16 with
$myCode = "If I showed code, I would probably get an answer I understood"
Today on Dirty Jobs, I try my hand at being an AutoIt Forum Moderator!

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Of course.

#include <GUIConstants.au3>
dim $appname = "TCP Sniffer"
Opt("GUIOnEventMode", 1)
GUICreate($appname, 830, 450)
$Edit1 = GUICtrlCreateInput ("",8,10,813,300)
$Edit2 = GUICtrlCreateInput ("To client",8,354,650,25)
$Edit3 = GUICtrlCreateInput ("To server",8,410,650,25)
$Button1 = GUICtrlCreateButton ("Send",670,354,150,25)
$Button2 = GUICtrlCreateButton ("Send",670,410,150,25)
GUISetState(@SW_SHOW)
; Start The TCP Services
;==============================================
TCPStartUp()

; Set Some reusable info
;--------------------------

Dim $szIPADDRESS = "62.50.35.181"
Dim $nPORT = 30001


; Initialize a variable to represent a connection
;==============================================
Dim $ConnectedSocket = -1


;Attempt to connect to SERVER at its IP and PORT 33891
;=======================================================

    $main_socket = TCPListen('127.0.0.1',30000)

    $clt_socket = TCPAccept($main_socket)


$string = "Connected to client" & @CRLF
GUICtrlSetData($Edit1, $string)

$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)


$string = "Connected to server" & @CRLF
GUICtrlSetData($Edit1, $string)
; If there is no error loop an inputbox for data
;   to send to the SERVER.
;Loop forever asking for data to send to the SERVER
; InputBox for data to transmit
        
; If they cancel the InputBox or leave it blank we exit our forever loop     
; We should have data in $szData... lets attempt to send it through our connected socket.
        While 1
                $Recv = TCPRecv($ConnectedSocket,1000)
        If $Recv  Then
            $string &= "[ToClient]:" & Hex($Recv) & @CRLF
            GUICtrlSetData($Edit1, $string)
        EndIf
        $msg = GUIGetMsg()
        Select
        Case $msg = $Button2
        TCPSend($ConnectedSocket,$Edit3)
        Case $msg = $Button1
        TCPSend($main_socket,$Edit2)
        EndSelect
        $Recv = TCPRecv($clt_socket,1000)
        If $Recv  Then
            $string &= "[ToServer]:" & Hex($Recv) & @CRLF
            GUICtrlSetData($Edit1, $string)
        EndIf
; If the send failed with @error then the socket has disconnected
;----------------------------------------------------------------
        If @error Then ExitLoop
    WEnd

TCPCloseSocket($ConnectedSocket)
Link to comment
Share on other sites

;Attempt to connect to SERVER at its IP and PORT 33891
;=======================================================

    $main_socket = TCPListen('127.0.0.1',30000)

    $clt_socket = TCPAccept($main_socket)


$string = "Connected to client" & @CRLF
GUICtrlSetData($Edit1, $string)

$ConnectedSocket = TCPConnect($szIPADDRESS,$nPORT)

TCPListen and TCPAccept are only used at the server side. I assume that this is the client script since you are trying to connect to the server.

Link to comment
Share on other sites

Im trying to log packets from client AND server, client with TCPListen and server with TCPConnect (dunno even if this works, if not, can u fix my script?). And ingore the "green texts" because i started this script with script from help file then modiflied a bit.

Edited by bf2forlife
Link to comment
Share on other sites

  • Developers

If I understand you well you would like to Snif IP packets and then the answer is simple: Is not possible.

The command you use are used when you have a true session between 2 machines, not sniffing packages.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

But can you snif packets from website? or game? or maybe from some flash stuff?

I must have been writing in riddles for you.

look for something like "NetworkActivPIAFCTMv1.5.exe" to get what you want.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Ok, thank you for that Jos, these autoit sniffers just dont work for me. I even tried sniffer directly from help file, but no, didnt work.

I don't think there is any sniffer example in the helpfile, only Client-server type applications, for the simple fact that for Sniffing type operations you need to monitor at a lower level than the IP stack. Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...