Jump to content
Sign in to follow this  
Romm

TCP & packets & WPE PRO

Recommended Posts

Romm

I start WPE PRO and then start logging process. Press button (macromedia flash game) in IE...

Then i get:

IP: 88.212.231.134 (example)

Port: 3030

And Open socket ID: 2420

But if i do this actions again, Open socket ID will be another. How to detect it with AutoIT? I tried TCPRecv but always get socket 3 chars length (and WPE PRO always - 4)

Share this post


Link to post
Share on other sites
DjDeep00

@Romm...Not sure if you already done so but did u look in the help file for all the TCP functions. They might be a good place to start.

Share this post


Link to post
Share on other sites
ChangMinYang

still need help

Example <= Found at TCPRecv

;SERVER!! Start Me First !!!!!!!!!!!!!!!

#include <GUIConstants.au3>

; Set Some reusable info

; Set your Public IP address (@IPAddress1) here.

Dim $szIPADDRESS = @IPAddress1

Dim $nPORT = 33891

; Start The TCP Services

;==============================================

TCPStartUp()

; Create a Listening "SOCKET".

; Using your IP Address and Port 33891.

;==============================================

$MainSocket = TCPListen($szIPADDRESS, $nPORT)

; If the Socket creation fails, exit.

If $MainSocket = -1 Then Exit

; Create a GUI for messages

;==============================================

Dim $GOOEY = GUICreate("My Server (IP: " & $szIPADDRESS & ")",300,200)

Dim $edit = GUICtrlCreateEdit("",10,10,280,180)

GUISetState()

; Initialize a variable to represent a connection

;==============================================

Dim $ConnectedSocket = -1

;Wait for and Accept a connection

;==============================================

Do

$ConnectedSocket = TCPAccept($MainSocket)

Until $ConnectedSocket <> -1

; Get IP of client connecting

Dim $szIP_Accepted = SocketToIP($ConnectedSocket)

Dim $msg, $recv

; GUI Message Loop

;==============================================

While 1

$msg = GUIGetMsg()

; GUI Closed

;--------------------

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

; Try to receive (up to) 2048 bytes

;----------------------------------------------------------------

$recv = TCPRecv( $ConnectedSocket, 2048 )

; If the receive failed with @error then the socket has disconnected

;----------------------------------------------------------------

If @error Then ExitLoop

; Update the edit control with what we have received

;----------------------------------------------------------------

If $recv <> "" Then GUICtrlSetData($edit, _

$szIP_Accepted & " > " & $recv & @CRLF & GUICtrlRead($edit))

WEnd

If $ConnectedSocket <> -1 Then TCPCloseSocket( $ConnectedSocket )

TCPShutDown()

; Function to return IP Address from a connected socket.

;----------------------------------------------------------------------

Func SocketToIP($SHOCKET)

Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _

"ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))

If Not @error And $aRet[0] = 0 Then

$aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))

If Not @error Then $aRet = $aRet[0]

Else

$aRet = 0

EndIf

$sockaddr = 0

Return $aRet

EndFunc

Edited by GoodMan

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.