Jump to content
Sign in to follow this  
Alexxander

Detect if another script is online -TCP- ?

Recommended Posts

Alexxander

hi all

how can i detect if another script is online ?

i tried this :

 

sender code:

TCPStartup()
$TCPcon = TCPConnect (@IPAddress1, 1234)
While 1
TCPSend($TCPcon, "hi")
WEnd

receiver code: 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

GUICreate("Form1", 100, 222)
$Mainlist = GUICtrlCreateList("", -1,-1, 615, 227)
GUISetState()

TCPStartup()
$TCPlisten = TCPListen(@IPAddress1, 1234)
$TCPaccept = TCPAccept($TCPlisten)

While 1
$GUImsg = GUIGetMsg()
If $GUImsg = $GUI_EVENT_CLOSE Then Exit
$TCPRecv = TCPRecv($TCPaccept, 99999999)
Do
$TCPaccept = TCPAccept($TCPlisten)
Until $TCPaccept <> -1

Do
GUICtrlSetData($Mainlist , "")
Until $TCPRecv <> ""
GUICtrlSetData($Mainlist , $TCPRecv)
WEnd

in receiver code: 

i cant understand what is happening when i use "DO" inside "While loop" and why tcp accept and tcp receive will not work when i remove the DO although there is while that supposed to make it always running

and why the close button is not closing the script

in sender code:

i know that i'm doing the connection wrong i must not use while

but i'm confused what i must use to tell the other side that i'm connected so im listed in his list ?

 

please help me this is the first time i use tcp


Share this post


Link to post
Share on other sites
FireFox

Hi,

Please take a look at the BETA helpfile examples.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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  

×