Jump to content

[SOLVED]What way is best to make my apps communicate with each other?


ludocus
 Share

Recommended Posts

Hi,

I'd like to know what the best way is to make my programs communicate with each other.

So that I can send commands from lets say my program controller to my media player.

I though about writing commands to a file and have every program check that file for a new command.

I also thought of doing it over tcp. Now can somebody help me by giving me the best way to do this?

Thnx!

Edited by ludocus
Link to comment
Share on other sites

Maybe this thread can help: Communicate between scripts on same pc

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Ok, something better ;)

Data interchange between Scripts

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Did you try the example in post #15?

"Here is a better version of the example of sending data from one program to another"

It seems to use another UDF to transfer data.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

ludocus,

I have always liked trancexx's MailSlot UDF. ;)

Here is a script I wrote to show it working based on the example in the topic:

#include "MailSlot.au3"

Global $sMailSlotListFile = @AppDataCommonDir & "\MailSlot\MailSlotList.lst"
Global $sMailSlotTitle = StringRegExpReplace(@ScriptName, "\..*$", "")
Global $sRandomMailSlotname = _RandomStr()

ConsoleWrite( $sMailSlotListFile  & @CRLF)

Global Const $sMailSlotName_Receive = "\\.\mailslot\" & $sRandomMailSlotname

; Add MailSlot to list file
IniWrite($sMailSlotListFile, "MailSlots", $sMailSlotTitle, $sRandomMailSlotname)

Global $hMailSlot = _MailSlotCreate($sMailSlotName_Receive)
If @error Then
    MsgBox(48, "MailSlot", "Failed to create new account!" & @CRLF & "Probably one using that 'address' already exists.")
    Exit
EndIf

Global $iNumberOfMessagesOverall
Global $sMailSlotName_Send = ""

Global $hGUI = GUICreate($sMailSlotTitle, 450, 400, 3 * @DesktopWidth / 4 - 225, -1, -1, 8) ; $WS_EX_TOPMOST

GUICtrlCreateLabel("Message To Send To:", 10, 22, 150, 25)
GUICtrlSetColor(-1, 0x0000CC)
GUICtrlSetFont(-1, 11)

Global $hSend_Combo = GUICtrlCreateCombo("", 180, 22, 100, 25)
_UpdateMail()

Global $hEdit_Send = GUICtrlCreateEdit("", 15, 50, 300, 50, 0x0040) ; $ES_AUTOVSCROLL

GUICtrlCreateLabel("Message Received:", 10, 122, 150, 25)
GUICtrlSetColor(-1, 0x0000CC)
GUICtrlSetFont(-1, 11)

Global $hEdit_Read = GUICtrlCreateEdit("", 15, 150, 300, 200, 0x0800) ; $ES_READONLY

Global $hButtonSend = GUICtrlCreateButton("&Send Mail", 330, 100, 100, 25)

Global $hButton_Update = GUICtrlCreateButton("&Update Accounts", 330, 50, 100, 25)

Global $hButtonRead = GUICtrlCreateButton("Read &Mail", 330, 150, 100, 25)

Global $hButtonCheckCount = GUICtrlCreateButton("&Check Mail Count", 330, 200, 100, 25)

Global $hButtonCloseAccount = GUICtrlCreateButton("Close Mail &Account", 330, 250, 100, 25)

Global $hButtonRestoreAccount = GUICtrlCreateButton("&Restore Account", 330, 300, 100, 25)

Global $hButtonCloseApp = GUICtrlCreateButton("&Exit", 330, 350, 100, 25)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case - 3, $hButtonCloseApp
            IniDelete($sMailSlotListFile, "MailSlots", $sMailSlotTitle)
            Exit
        Case $hButtonSend
            If GUICtrlRead($hSend_Combo) = "" Then
                MsgBox(64, "MailSlot demo", "No account selected!", 0, $hGUI)
            Else
                $sMailSlotName_Send = "\\.\mailslot\" & IniRead($sMailSlotListFile, "MailSlots", GUICtrlRead($hSend_Combo), "")
                If $sMailSlotName_Send <> "\\.\mailslot\" Then
                    _SendMail($sMailSlotName_Send)
                Else
                    MsgBox(48, "MailSlot demo", "Not valid account!", 0, $hGUI)
                EndIf
            EndIf
        Case $hButton_Update
            _UpdateMail()
        Case $hButtonRead
            If $hMailSlot Then
                _ReadMessage($hMailSlot)
            Else
                MsgBox(48, "MailSlot demo", "No account is available!", 0, $hGUI)
            EndIf
        Case $hButtonCheckCount
            If $hMailSlot Then
                _CheckCount($hMailSlot)
            Else
                MsgBox(48, "MailSlot demo", "No account is available!", 0, $hGUI)
            EndIf
        Case $hButtonCloseAccount
            If $hMailSlot Then
                _CloseMailAccount($hMailSlot)
            Else
                MsgBox(64, "MailSlot demo", "No account is available!", 0, $hGUI)
            EndIf
        Case $hButtonRestoreAccount
            If $hMailSlot Then
                MsgBox(64, "MailSlot demo", "This account already exists!", 0, $hGUI)
            Else
                _RestoreAccount($sMailSlotName_Receive)
            EndIf
    EndSwitch

WEnd


; Wrapper functions:

Func _UpdateMail()

    Local $aMailSlots = IniReadSection($sMailSlotListFile, "MailSlots")

    If Not IsArray($aMailSlots) Then MsgBox(64, "MailSlot demo", "No accounts available!", 0, $hGUI)

    Local $sMailSlotList = "|"
    For $i = 1 To $aMailSlots[0][0]
        If $aMailSlots[$i][1] <> $sRandomMailSlotname Then $sMailSlotList &= $aMailSlots[$i][0] & "|"
    Next
    GUICtrlSetData($hSend_Combo, $sMailSlotList)

EndFunc

Func _SendMail($sMailSlotName)

    Local $sDataToSend = GUICtrlRead($hEdit_Send)

    If $sDataToSend Then
        _MailSlotWrite($sMailSlotName, $sDataToSend);, 1)
        Switch @error
            Case 1
                MsgBox(48, "MailSlot demo error", "Account that you try to send to likely doesn't exist!", 0, $hGUI)
            Case 2
                MsgBox(48, "MailSlot demo error", "Message is blocked!", 0, $hGUI)
            Case 3
                MsgBox(48, "MailSlot demo error", "Message is send but there is an open handle left." & @CRLF & "That could lead to possible errors in future", 0, $hGUI)
            Case 4
                MsgBox(48, "MailSlot demo error", "All is fucked up!" & @CRLF & "Try debugging MailSlot.au3 functions. Thanks.", 0, $hGUI)
            Case Else
                MsgBox(64, "MailSlot demo", "Sucessfully sent!", 0, $hGUI)
        EndSwitch
        GUICtrlSetData($hEdit_Send, "")
    Else
        MsgBox(64, "MailSlot demo", "Nothing to send.", 0, $hGUI)
    EndIf

EndFunc   ;==>_SendMail

Func _ReadMessage($hHandle)

    Local $iSize = _MailSlotCheckForNextMessage($hHandle)

    If $iSize Then
        Local $sData = _MailSlotRead($hMailSlot, $iSize, 1)
        $iNumberOfMessagesOverall += 1
        GUICtrlSetData($hEdit_Read, "Message No" & $iNumberOfMessagesOverall & " , Size = " & $iSize & " :" & @CRLF & @CRLF & $sData)
    Else
        MsgBox(64, "Nothing read", "MailSlot is empty", 0, $hGUI)
    EndIf

EndFunc   ;==>_ReadMessage


Func _CheckCount($hHandle)

    Local $iCount = _MailSlotGetMessageCount($hHandle)
    Switch $iCount
        Case 0
            MsgBox(64, "Messages", "No new messages", 0, $hGUI)
        Case 1
            MsgBox(64, "Messages", "There is 1 message waiting to be read.", 0, $hGUI)
        Case Else
            MsgBox(64, "Messages", "There are " & $iCount & " messages waiting to be read.", 0, $hGUI)
    EndSwitch

EndFunc   ;==>_CheckCount


Func _CloseMailAccount(ByRef $hHandle)

    If _MailSlotClose($hHandle) Then
        $hHandle = 0
        MsgBox(64, "MailSlot demo", "Account succesfully closed.", 0, $hGUI)
        IniDelete($sMailSlotListFile, "MailSlots", $sMailSlotTitle)
    Else
        MsgBox(48, "MailSlot demo error", "Account could not be closed!", 0, $hGUI)
    EndIf

EndFunc   ;==>_CloseMailAccount


Func _RestoreAccount($sMailSlotName_Receive)

    Local $hMailSlotHandle = _MailSlotCreate($sMailSlotName_Receive)

    If @error Then
        MsgBox(48, "MailSlot demo error", "Account could not be created!", 0, $hGUI)
    Else
        MsgBox(64, "MailSlot demo", "New account with the same address successfully created!", 2, $hGUI)
        $hMailSlot = $hMailSlotHandle ; global var
        IniWrite($sMailSlotListFile, "MailSlots", $sMailSlotTitle, $sRandomMailSlotname)
    EndIf

EndFunc   ;==>_RestoreAccount

Func _RandomStr()
    Local $sString
    For $i = 1 To 13
        $sString &= Chr(Random(97, 122, 1))
    Next
    Return $sString
EndFunc   ;==>__RandomStr

Compile it, then copy it a few times and rename the copies with unique names. Run all the exes and you can send messages happily between them. Do not forget to "Update Accounts" so that the early instances can see who has joined later - otherwise you find no addresses to send to. ;)

It would require a bit of work to incorporate into your scripts - over to you to decide if it is worth it. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 weeks later...

Func _UpdateMail()

Local $aMailSlots = IniReadSection($sMailSlotListFile, "MailSlots")

If Not IsArray($aMailSlots) Then

MsgBox(64, "MailSlot demo", "No accounts available!", 0, $hGUI)

Else

Local $sMailSlotList = "|"

For $i = 1 To $aMailSlots[0][0]

If $aMailSlots[$i][1] <> $sRandomMailSlotname Then $sMailSlotList &= $aMailSlots[$i][0] & "|"

Next

GUICtrlSetData($hSend_Combo, $sMailSlotList)

Endif

EndFunc

Hi Melba23,

Made a few changes in the above code .

Secondly, since this is a realtime application , there are a few points which I would like to shed light on. When using with NTFS, the file creation takes time due to *hint* "dirty pages / cache" and in an application which requires the input at a much faster rate , it would be advisable to utilise the GUI for writing the INI values instead of INIfile itself on the disk (Disk I/O).

I had faced a problem due to NTFS 's delay in commiting these changes onto the media.

Utilisation of mailslot is good, add a lil bit of encryption and a small verification for all the values which are being read will secure the data-value which needs to be passed and will make life difficult for reverse engineers.

Using TCP as IPC has its own pitfalls delay in starting up TCP, sniffers , securing the mode of communication requires more efforts.

Rgds

deltarocked

Link to comment
Share on other sites

  • Moderators

deltarocked,

I quite understand your reasons for not wanting to use a disk-based file but I am confused by: ;)

it would be advisable to utilise the GUI for writing the INI values

Surely that is what is already happening? You need the external ini file accessible to all participating processes to hold the available mailslot addresses and each of the processes writes to and reads from it.

Could you please post your altered code so I see what you mean more clearly? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

deltarocked,

I quite understand your reasons for not wanting to use a disk-based file but I am confused by: ;)

Surely that is what is already happening? You need the external ini file accessible to all participating processes to hold the available mailslot addresses and each of the processes writes to and reads from it.

Could you please post your altered code so I see what you mean more clearly? :)

M23

The code posted is the modified code .... check for IsArray's If Else Condition.... it is missing in your post.

Initially I was using Fileread/write for IPC but then I ran into problems , as in this case you are using iniwrite as a mode of IPC during the initial stages of the app start.

External INI : reading and writing an external INI increases the DiskIO as I had experienced in one of my applications. At present am in the process of adding mailslots and instead of directly writing the INI on the disk am using a GUI EDIT (Temporary) to store the values of the ini (to increase the data-access speed of the application), as I also do not want any other entity to modify either the memory , so I have deployed AES encryption and am validating the data input which is sent and received. The whole transaction lasts not more than 500ms (time is essence , so is security and also Data Retention) Encryption with DISKIO takes a bit more time and gives erronous results due to NTFS dirty pages / cache / media commit.

Not many methods are available for IPC (namedpipes, com, mailslots and WM_COPYDATA) and am still searching for the fastest one. Using a hidden window with EditField is still the fastest to code (very less conditions to be matched as only the strings are to be matched) and to execute.

Eg.

Take a USB PenDrive format it using FAT16/32 , create a MDB file create a table and start adding records into this mdb at the same time display the value which has been written into the MDB on to your screen. At one point forcibly(Physically) remove the PenDrive. Observe the results

Format a USB PenDrive format it using NTFS , create a MDB file create a table and start adding records into this mdb at the same time display the value which has been written into the MDB on to your screen. At one point forcibly(Physically) remove the PenDrive. Observe the results and compare them with the FAT16/32 based MDB, you find that NTFS doesnt retain the Data which has been very recently added. (Delayed Write Fail) On your screen you see one value and inside the MDB you will find something else.

On Fixed Drive this Problem is difficult to replicate but it does occur.

Link to comment
Share on other sites

  • Moderators

deltarocked,

Thank you for having taken the trouble to respond.

#1. As you used a quote I assumed it was my own code and did not look any closer! If you are posting new code, you might want to use Code tags next time. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here).

Turning to your amended code - is such a check really necessary? If you have a client running, you would always get a valid array returned from the ini file. If you have no clients, what is going to attempt to access the blank ini file? :) Or was it because of the write latency problem you mentioned?

#2. I quite understand your "GUI ini" point now - I must have been feeling particularly dense this morning - not that such a state is unusual! A clever solution! ;)

As for your tests, I will take your word for the results - I try and treat my setup with a bit more respect than that!

Just to make clear again, all credit for this clever and useful code goes to trancexx - I just wrote a bit of a wrapper to show it working.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi M23,

The reason for this lengthy reply was that I have seen many posts on IPC and some of the fellow members are trying very hard to get a working solution, but some features of windows are just impossible to understand.

Someone someday might stumble upon this conversation and it might make up his day.

As they say - Knowledge shared is knowledge gained.

Ciao

Deltarocked.

PS:

http://technet.microsoft.com/en-us/library/cc781134%28WS.10%29.aspx

To ensure that a transaction can either be completed or rolled back, NTFS performs the following steps for each transaction:

1. Records the metadata operations of a transaction in a log file cached in memory.

2. Records the actual metadata operations in memory.

3. Marks the transaction in the cached log file as committed.

4. Flushes the log file to disk.

5. Flushes the actual metadata operations to disk.

Steps 4 and 5 occur in a lazy fashion after the transaction is completed, meaning that the flush operations are not tied to the transaction itself. Instead, NTFS modifies the log and metadata quickly in memory, and then flushes later at a convenient time to boost performance.

Link to comment
Share on other sites

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Local $val_pid = 0
Global $Form1 = 0, $Input1 = 0, $PID = 0, $PID_Len = 0, $server = 0, $Input2 = 0
OnAutoItExitRegister('ExitClient')
$PID = @AutoItPID
$PID_Len = StringLen($PID)
If WinExists("Form1IPC1234567890") == 0 Then
    $Form1 = GUICreate("Form1IPC1234567890", 251, 120, 379, 198, 0, 0)
    $Input1 = GUICtrlCreateInput("", 0, 8, 249, 21, $ES_READONLY) ; PID of clients
    ;GUICtrlSetState(-1, $GUI_HIDE) ; replace the ';' at the begining of the line
    $Input2 = GUICtrlCreateInput("", 0, 40, 249, 21, $ES_READONLY) ; message
    ;GUICtrlSetState(-1, $GUI_HIDE) ; replace the ';' at the begining of the line
    $Input3 = GUICtrlCreateInput($PID, 0, 72, 249, 21, $ES_READONLY) ; Server PID
    ;GUICtrlSetState(-1, $GUI_HIDE) ; replace the ';' at the begining of the line
    GUISetState(@SW_SHOW) ; replace @SW_SHOW with @SW_HIDE
    $server = 1
Else
    $spid = ControlGetText("Form1IPC1234567890", '', 3)
    ControlSetText("Form1IPC1234567890", '', 3, $spid & ',' & $PID & ',')
    ControlSetText("Form1IPC1234567890", '', 4, ControlGetText("Form1IPC1234567890", '', 5) & $PID & '-' & 'ok')
EndIf
; can utilise an array and display a nice cool dropdown with
; gui interface to send message within the started processes
; otherwise it would be server to client or vice versa
; the payload can be variable name with the variable value or just the value
; in case you are using variable name as a part of the message then care needs
; to be taken to include these variable in your Select Case conditions
; eg.
; $ctrlvar = stringsplit($ctrlread,'whatever')
; Select
; Case $ctrlvar = 'variable1'
;   Conditions for the values that you might want to keep a tab on
; Case $ctrlvar = 'variable2'
; .......
While 1
    $ctrlread = StringReplace(ControlGetText("Form1IPC1234567890", '', 4),',','') ;decrypt
    $val_pid = StringLeft($ctrlread, $PID_Len)
    $ctrlread = StringTrimLeft($ctrlread, $PID_Len)
    If $val_pid == $PID And $server == 0 Then ; for client
        $ctrlread = StringSplit(StringReplace($ctrlread,',',''), '-', 1)
        If IsArray($ctrlread) == 1 Then
            Select
                Case StringLower($ctrlread[2]) == 'end'
                    Exit
                Case Else
                    If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
                    $sInputBoxAnswer = InputBox($PID & ' Received', "Received message : " & @CRLF & $ctrlread[2] & @CRLF & 'from Process PID :' & _
                            $ctrlread[1] & @CRLF & "Send a Reply", "", " M")
                    ;sanitization of '-' in inputbox required too bored to write this code
                    If StringStripWS($sInputBoxAnswer, 8) <> '' Then
                        ControlSetText("Form1IPC1234567890", '', 4, $ctrlread[1] & $PID & '-' & $sInputBoxAnswer) ;encrypt the string
                    EndIf
            EndSelect
        EndIf
    ElseIf $val_pid == $PID And $server == 1 Then ; for server
        $ctrlread = StringSplit($ctrlread, '-', 1)
        If IsArray($ctrlread) == 1 Then
            Select
                Case StringLower($ctrlread[2]) == 'end'
                    ControlSetText("Form1IPC1234567890", '', 4, $ctrlread[1] & $PID & '-' & 'end') ;encrypt the string
                    $lastmsg=$ctrlread[1] & $PID & '-' & 'end'
                Case Else
                    ControlSetText("Form1IPC1234567890", '', 4, $ctrlread[1] & $PID & '-' & 'server received ' & $ctrlread[2] & ' from ' & $ctrlread[1]) ;encrypt the string
                    $lastmsg=$ctrlread[1] & $PID & '-' & 'end'
            EndSelect
        EndIf
    EndIf
    Sleep(100)
WEnd
Func ExitClient()
    If $server <> 1 Then
        $replace = ControlGetText("Form1IPC1234567890", '', 3)
        $replace = StringReplace($replace, ',' & $PID & ',', '')
        ControlSetText("Form1IPC1234567890", '', 3, $replace)
    EndIf
EndFunc ;==>ExitClient

Something similar to this.... since sender and receiver are bundled up into one script it becomes a bit more confusing.... but if you know which app is server and which app is the client then this becomes much more simpler...

i am using two different scripts cause my needs are different - no inputbox just the runtime variable values are being used.... and for me the application resides on local computer and not on network so again the headache of managing the network part is out of question. ;)

regards

Deltarocked

Edited by deltarocked
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...