home *** CD-ROM | disk | FTP | other *** search
- $title('sfrag - initiate a transaction that forces receive fragmentaion')
- $compact
- /********************************************************************
- *
- * MODULE NAME: sfrag
- *
- * DESCRIPTION: Send a transaction request to a well-known socket.
- * The request is sent with a data part to force receive
- * fragmentation if the buffers at the receive port are
- * less than 2K. Wait for a response and print the
- * message on the console.
- *
- *********************************************************************/
-
- sfrag: 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 */
- REMHOSTID LITERALLY '3', /* hostid of remote host */
- CONBUF LITERALLY '20', /* control buffer size */
- RSVPB LITERALLY '128', /* rsvp buffer size */
- TSTPORT LITERALLY '801H', /* well-known port */
- NOEXCEPT LITERALLY '0', /* no exception handling by system */
- SFLAGS LITERALLY '00000B'; /* data buffer, synch, rcvreply 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 */
- rsvp_buf (RSVPB) BYTE, /* rsvp buffer */
- mess_size DWORD, /* number of bytes in data message */
- rsvp_size DWORD, /* rsvp buffer size */
- rsvp_ptr POINTER, /* points to rsvp message */
- info rec_info, /* receive info block */
- buf_pool TOKEN, /* buffer pool attached to port */
- mbuf(2048) BYTE INITIAL(37,'This was received via fragmentation',0ah,0dh),
- trans_id WORD; /* transaction id */
-
- CALL set$exception(NOEXCEPT);
- port_t = get$dport(TSTPORT, @buf_pool, CHAIN, @status);
- messock.host_id = REMHOSTID;
- messock.port_id = REMPORT;
- mess_size = size(mbuf);
- rsvp_size = RSVPB;
- CALL MOVB(@(29,'This is the second fragment',0dh,0ah),@mbuf(1024), 30);
- trans_id = rq$send$rsvp(port_t,msock, @con_buf, @mbuf,
- mess_size, @rsvp_buf, rsvp_size, SFLAGS, @status);
- CALL error$check(100, status);
- rsvp_ptr = rq$receive$reply(port_t, trans_id, WAITFOREVER, @info, @status);
- CALL error$check(110, status);
- call rqc$send$eo$response(NIL,0,@rsvp_buf,@status);
- CALL error$check(120, status);
- call rq$exit$io$job(0,NIL,@status);
-
- END sfrag;
-