Jump to content

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)

GUISetState()
TCPStartup()

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

 

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

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

any ideas ?

Edited by alexander95
Fixed tags

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