joseLB Posted November 27, 2009 Share Posted November 27, 2009 HiI have being searching forum for an UDF that implements process to process comunnications, and was unsucessful.But my guess is that there is something about it, as this probably is used by many people.So, I devised (didn't implement) the functions that follows, and:1- could you tell me if there is something similar or better, but somewhat simple to use already done?2- if I go to implement, I'm thinking into use ENVGET and ENVSET as the low level comm. mechanism. Do you sugest another way? for what I read at help, these routines just works on "programs that AutoIt spawns (Run, RunWait). " That's somewhat limiting... for what I read at forum they are not exactly a hi speed channel, that's another limiting factor.3- any other advice / suggestion?ThanksJoseexpandcollapse popupFunc _p2pInit ($channel, $buffers=2) ; #FUNCTION# ============================================================================ ; Name...........: _p2pInit ; Description ...: creates a channel for communications betwen 2 or more processes. ; Syntax.........: _p2pInit ($channel,[$buffers=2]) ; Parameters ....: $channel - string with a unique name for the channel. ; $buffers - optional - number of buffers used by this channel. Minimum 2. ; These buffers are used in a circular manner ; ; Return values .: 1 - channel created ; 0 - error - channel was not created (it could exist previously) ; in this case it's just a warning and can be used -> see @error = 1 ; @error: 0 ok ; 1 - channel already exists ; 2 - invalid channel name or number of buffers ; ======================================================================================= EndFunc Func _p2pSend ($channel="",$msg, $ansChannel=-1) ; #FUNCTION# ============================================================================ ; Name...........: _p2pSend ; Description ...: send a message thru a given channel ; Syntax.........: _p2pSend ($channel,$msg, [$ansChannel=-1]) ; Parameters ....: $channel - string with channel name. It must be previously created by _p2pInit ; $msg - message to be send. If $message= -1, all pending messages are cleared on that channel ; $ansChannel (optional)- string with the name of another previously created channel, ; so the receiver can answers to this message. ; (Sender and Receiver must agree (have the logic) on $ansChannel mechanism) ; ; Return values .: 1 - message sucessfuly sent ; 0 - error ; @error 1 -> channel does not exists ; 2 -> no avaiable buffer (the other partie didn't consume messages in a speedy manner) ; ======================================================================================= EndFunc Func _p2pGet($channel, $timeout=5, %ByRef $ansChannel=-1) ; #FUNCTION# ============================================================================ ; Name...........: _p2pGet ; Description ...: receive a message from a given channel ; Syntax.........: _p2pGet($channel, [$timeout=5]) ; Parameters ....: $channel - string with channel name. It must be previously created by _p2pInit ; $timeout - default =0 -> waits up to this amount of seconds for a message to arrive. If 0, not wait ; $ansChannel (optional)- string where the receiver can get the name of a previously created channel, ; if he intents to answer about this message to the sender. ; (Sender and Receiver must agree (have the logic) on $ansChannel mechanism) ; ; Return values .: string with message received ; 0 - error ; @error 1 -> channel does not exists ; 2 -> no message exists (valid only if $timeout = 0) ; 3 -> timeout (no messages arrived) ;remarks: ; - a receiver can receive messages from many senders ; - thru $ansChannel a receiver can send relplies to a specific sender/message ; ======================================================================================= EndFunc Link to comment Share on other sites More sharing options...
KaFu Posted November 27, 2009 Share Posted November 27, 2009 GUIRegisterMsg() is another way: http://www.autoitscript.com/forum/index.php?showtopic=76013&view=findpost&p=551229 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
jvanegmond Posted November 27, 2009 Share Posted November 27, 2009 This was asked the other day as well: http://www.autoitscript.com/forum/index.php?showtopic=105861 github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now