Jump to content
Sign in to follow this  
bf2forlife

Lagging when using TCP

Recommended Posts

bf2forlife

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?

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
bf2forlife

One more thing, it starts lagging when the TCPConnect($ip, $port) is before the TCPListen('127.0.0.1', $port), and when i put the TCPListen first, nothing happends. Can someone help?

Share this post


Link to post
Share on other sites
bf2forlife

bump :)

Share this post


Link to post
Share on other sites
bf2forlife

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)

Share this post


Link to post
Share on other sites
Kip

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

Share this post


Link to post
Share on other sites
bf2forlife

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

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
bf2forlife

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

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
bf2forlife

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.

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
bf2forlife

Well the example was TCPRecv()

Share this post


Link to post
Share on other sites
bf2forlife
:)

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  

×