Jump to content

Inter-process comms - need advice


storme
 Share

Recommended Posts

G'day all

Just want some advice... from those that have already done it if possible.

What I want to do is to create a "simple" "User data collector" that acts as a server (Inter-process comms).

I then want to create a UDF I can add to each "client" program that needs the user data.

So that is skeleton of the idea.

Can anyone suggest a method (I know there are many) that would handle this?

WHY do I want to do this?

I created a simple program to collect user data (name, address, etc) to email back to the office to update records.

Non sensitive information is stored in an INI file for later use (i.e the next time I work on the computer).

This quickly got extended to enter this data and passwords into various programs as they are being installed.

But now I've got a rather large section of the "simple" program that looks for windows and enters data and it's getting very messy with all the programs it supports...

Now for some more details.

  1. The server won't know what clients or how many clients there will be.
       Potentially there could be multiple programs requesting information at the same time
  2. Passwords will be passed through this system so shouldn't be easily seen (e.g. customer looking over my shoulder)
       Also would be good if it isn't easy for programs to just grab the info...  
  3. (A wish only) - If the information isn't available the client can request that the server program asks for the information.
       So this will require 2 way communications.
  4. Server can be started by client
       This should be easy as I have a defined folder structure and I can just run it, pause then re-request the info.
  5. System must handle text and numbers but not necessarily binary data (Though this would be a bonus).

Well the list wasn't as long as I thought it would be. :)

So what are your suggestions on an inter-process comms method that would allow all that?

If there is anything else I should consider please let me know.

Thanks All

John Morrison

Link to comment
Share on other sites

I use WM_COPYDATA (see signature) to send data to processes created by me or that can interact with the WM_COPYDATA message e.g, SciTE.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thanks JohnOne, Inverted and guinness

JohnOne

TCP had crossed my mind but I'd rather not as too any parts of the system have to be running for TCP to be working and most of the systems I work on are broken in some way.

Thanks!

inverted

NamedPipes look interesting but I couldn't find enough details/examples to see if it would fit the bill.  The help file is very sparse in it's handling of named pipes. :(

Thanks!

guinness

WM_COPYDATA looks promising and I have found a few examples and some nice articles that should fill in the blanks.  When I went to your original example I thought "This is not up to his usual standard..." (just the bare bones)  Then I saw that it was 3 years ago :) and realized that it wasn't the coding Juggernaut we have now that had written the example. :)

THANKS!

So I'll do a little playing and see what I can come up with.

Of course the next step is working out a system to pass messages/variables over the "link".  Any suggestions? :)

Thanks again!

John Morrison

Link to comment
Share on other sites

My example is informative and working.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

My example is informative and working.

With no commenting in either the UDF or the Example it makes it hard to expand on either to make any reliable code.

For example.

From the example

_WM_COPYDATA_SetID('BAC92AA6-FDD8-11E1-91FF-3EE2937D8BEC')

Calls this in the UDF

Func _WM_COPYDATA_SetID($sIDString)
    $__vInterCommunicationAPI[$__sInterCommunicationIDString] = $sIDString
    Return $sIDString
EndFunc   ;==>_WM_COPYDATA_SetID

I now know that the ID is used to identify the .... well I'm not sure now... communications channel/program???

Someone else may just grab your code use it and it works out of the box.  Until 2 programs using the same ID (neither programers knew it had to be unique) end up on the same computer and get their messages mixed up.

What is the function _WM_COPYDATA_GetGUI() used for?  Should I use it or is it just internal?

And the question I haven't found an answer to yet.  How much data can I transfer using this? AND is there any restriction on the type of data (eg String only or binary data OK)??

Anyway that is what I meant by (just the bare bones)....

Thanks again

John

Link to comment
Share on other sites

I will add comments when I have finished working on the important stuff e.g. help file and UDFs.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Thanks trancexx

Mailslots was another one I looked at in the past.

I "think" I dismissed it at the time (for that project) because it had a small message size....

I've done a search now but can't find the size limit so I maybe misremembering.. :(  Do you know what the limit is?

I do like the UDF though and if the limit (if it exists) isn't severe then it will solve a few situations I would have had to write code to handle. :)

Thanks for the info

John Morrison

Link to comment
Share on other sites

Have you considered using an sqlite database for comms?

One drawback would be that there can be only one user who can wrire to the database if used over a network. (if I recall correctly)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Have you considered using an sqlite database for comms?

One drawback would be that there can be only one user who can wrire to the database if used over a network. (if I recall correctly)

That's not an issue as this is only to be on the one computer and only by one user at a time.

The trouble is I'd prefer if information isn't left "laying around" on the computer.  (E.G. my passwords)

That is why the other methods are more attractive as sensitive info (like passwords) will disappear as soon as the server terminates.

Unless you have something that will remove this concern?

Thanks for the suggestion!

John Morrison

Link to comment
Share on other sites

Thanks trancexx

Mailslots was another one I looked at in the past.

I "think" I dismissed it at the time (for that project) because it had a small message size....

I've done a search now but can't find the size limit so I maybe misremembering.. :(  Do you know what the limit is?

I do like the UDF though and if the limit (if it exists) isn't severe then it will solve a few situations I would have had to write code to handle. :)

Thanks for the info

John Morrison

There are no limits for the usage you describe.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

That's not an issue as this is only to be on the one computer and only by one user at a time.

The trouble is I'd prefer if information isn't left "laying around" on the computer.  (E.G. my passwords)

That is why the other methods are more attractive as sensitive info (like passwords) will disappear as soon as the server terminates.

Unless you have something that will remove this concern?

Thanks for the suggestion!

John Morrison

I'd assume you would know where any passwords would be stored in the db, they'd just have to be removed on app exit, or the whole db file destroyed depending on your needs.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

As a sidenote, any SQLite database can be secured at any time by strong encryption. You just have to provide the password which you can get thru volatile input or other means. All operation is unchanged.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

As a sidenote, any SQLite database can be secured at any time by strong encryption. You just have to provide the password which you can get thru volatile input or other means. All operation is unchanged.

Hmmm never thought of protecting the entire database like that....

AND it would solve some problems I have with another program/concept I have....

Thanks Mate you've given me a lot to think about

John Morrison

Link to comment
Share on other sites

I'd assume you would know where any passwords would be stored in the db, they'd just have to be removed on app exit, or the whole db file destroyed depending on your needs.

The only trouble is it relies on the program running to it's end end deleting the file...... If the program crashes then the password is left open in the system.

.

.

Just thought of the solution to that.  Create the DB with the password in it and set a "delete on start" entry to have it removed.

That way even if the program crashes the file will be deleted....Though it could be undeleted....sigh

Thanks!

John Morrison

Link to comment
Share on other sites

There are no limits for the usage you describe.

But what at the limitations?

Is there a size limit on the messages that can be sent?

Just for my own reference in case I find a use for it in another context but run into an unknown limitation.

Thanks!

John Morrison

Link to comment
Share on other sites

If you ever need encryption of an SQLite DB, you need to download a mixed-assembly precompiled binary from this site. Choose the x86 or x64 version depending on your AutoIt build option.

Refer to >this thread for using the encryption feature.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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