Jump to content
Sign in to follow this  

keep connection alive between 2 scripts ?

Recommended Posts

hi all


this is the first script

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

GUICreate("Form1", 708, 174, 192, 124)
$mylist = GUICtrlCreateList("", 176, 32, 121, 97)


While 1
$TCPListen = TCPListen(@IPAddress1, 403)
$TCPAccept = TCPAccept ($TCPListen)
If GuiGetMsg() = $GUI_EVENT_CLOSE Then Exit
Until $TCPAccept <> -1
If GuiGetMsg() = $GUI_EVENT_CLOSE Then Exit
$TCPRecive = TCPRecv ($TCPAccept, 1000000)
Until $TCPRecive <> ""
GUICtrlSetData($mylist, $TCPRecive)
If $TCPAccept = -1 then GUICtrlSetData($mylist, "")


as u see what this script does that it wait for a tcp msg from another script on the same port then view it in a list.

basicly it is working it is viewing what the other script sends

but when i close the other script it still view 

i want it to delete what is recived from the othr script the the connection goes off

here is the other script

$PCname = @ComputerName
While 1
$TCPConnect = TCPConnect(@IPAddress1, 403)
TCPSend ($TCPConnect, "hi")
Sleep (1000)

any ideas ?

Edited by alexander95
Fixed tags

Share this post

Link to post
Share on other sites


You may take a look at the TCP examples in the beta helpfile to correctly use the TCP functions.

To answer your question: Add an error check after the TCPRecv function.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...