Guidance
指路人
g.yi.org
Software / Reginald / Examples / mailslot / clientslot.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* An example of using Reginald REXX to FUNCDEF
 * and use Windows Mail Slots.
 *
 * This is the script that runs on the client
 * computer. It sends a record to the respective
 * script that runs on the server (ie, serverslot.rex).
 */

/* NOTE!!! You should change the asterisk to the name of the server
 * computer that is running serverslot.rex unless you want to send
 * records to every mailslot named "testslot" on the root domain
 */
mailslotname = "\\*\mailslot\testslot"

/* So that we don't need the CALL keyword */
ADDRESS null

/* Trap SYNTAX for errors */
/* Trap HALT for user abort and cleanup */
SIGNAL ON SYNTAX
SIGNAL ON HALT

/* Trap NOTREADY so that we don't have to check for errors on STREAM and CHAROUT */
SIGNAL ON NOTREADY

/* Open the mailslot that the server has already created on the network.
 * Note: The serverslot.rex example must already be running. We must
 * use STREAM's 'OPEN WRITE SHARED' mode.
 */
STREAM(mailslotname, 'C', 'OPEN WRITE SHARED')

/* Here are the contents of what I intend to send. It can be anything
 * you want, text or binary or whatever.
 */
mymessage = "This is a test."

/* Send the record. It is broadcast to every computer in the primary
 * domain of the system (because of our use of the asterisk on the
 * mailslot name). To select a particular computer, you'd have
 * to be more specific in the mailslot name passed to STREAM().
 *
 * A single call to CHAROUT or LINEOUT writes one record.
 */
CHAROUT(mailslotname, mymessage)

/* Close the mailslot. NOTE: REXX does this automatically for you when
 * your script ends if you forget
 */
STREAM(mailslotname, 'C', 'CLOSE')

RETURN



/* ======================= Error Handling ======================= */
notready:
syntax:
failure:
    /* NOTE: CONDITION('D') fetches error message. CONDITION('E') fetches the
     * error number. SIGL is the line number where the error occurred.
     */
	CONDITION('M')

halt:
	RETURN
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Mon 2024-3-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:40:58