home *** CD-ROM | disk | FTP | other *** search
- $title('smsg - send a 2K message to a known port')
- $compact
- /********************************************************************
- *
- * MODULE NAME: smsg
- *
- * DESCRIPTION: send a 2K message in order to force data chaining since
- * the receiving process has only allocated 1K buffers.
- * The data is contiguous on the sender's side but is
- * received as a data chain by the receiver
- *
- *
- *********************************************************************/
-
- smsg: DO;
-
- $include(:rmx:inc/rmxplm.ext)
- $include(dcom.ext)
- $include (dcom.lit)
- $include(:rmx:inc/error.lit)
- $include(err.ext)
-
- DECLARE /* Literals */
-
- REMPORT LITERALLY '801H', /* Port id of remote port */
- REMHOST LITERALLY '05', /* Host id of remote host */
- FATALERR LITERALLY '3', /* fatal error code */
- CONBUF LITERALLY '16', /* size of a control buffer */
- TSTPORT LITERALLY '801H', /* well-known port */
- NOEXCEPT LITERALLY '0', /* no exception handling by system */
- SFLAGS LITERALLY '00000B'; /* data buffer, synchronous flags*/
-
- DECLARE /* Global vars */
-
- status WORD,
- port_t TOKEN, /* Token for local port */
- messock socket, /* socket to which message is sent */
- msock DWORD AT (@messock), /* dword alias for messock */
- con_buf (CONBUF) BYTE, /* control buffer */
- mbuf(2052) BYTE INITIAL(50,'This is the first buffer received via data chain',0ah,0dh),
- mess_size DWORD, /* number of bytes in data message */
- bpool TOKEN, /* buffer pool attached to port */
- trans_id WORD; /* transaction id */
-
- CALL set$exception(NOEXCEPT);
- port_t = get$dport(TSTPORT, @bpool, CHAIN, @status);
- CALL MOVB(@(57,'This message was in the second buffer in the data chain',0dh,0ah),@mbuf(1026), 58);
- messock.host_id = REMHOST;
- messock.port_id = REMPORT;
- mess_size = size(mbuf);
- trans_id = rq$send(port_t,msock, @con_buf, @mbuf, mess_size,
- SFLAGS, @status);
- CALL error$check(100, status);
- CALL rq$exit$io$job(0,NIL,@status);
-
- END smsg;
-