$! RAW_SOCKET.COM $! Not intended as anything other than illustrative. $! 30-NOV-2016 MGD initial $! $ wrwso = "write RawSocketOutput" $ wrsys = "write sys$output" $ crlf[0,16] = %x0a0d $ UsageCount = 0 $ FirstUsed = f$time() $ open /read CgiPlusIn CGIPLUSIN $! $ RequestLoop: $! $! (block waiting for request, this initial read is always discardable) $ read CgiPlusIn /end=EndRequestLoop Line $ UsageCount = UsageCount + 1 $! $ WWW_WEBSOCKET_INPUT = "" $ WWW_WEBSOCKET_OUTPUT = "" $! $! (read the CGIplus variable stream looking for the WebSocket variables) $ CgiVarLoop: $ read CgiPlusIn /end=EndCgiVarLoop Line $ if Line .eqs. "" then goto EndCgiVarLoop $ if f$extract(0,20,Line) .eqs. "WWW_WEBSOCKET_INPUT=" - then WWW_WEBSOCKET_INPUT = f$extract(21,999,Line) $ if f$extract(0,21,Line) .eqs. "WWW_WEBSOCKET_OUTPUT=" - then WWW_WEBSOCKET_OUTPUT = f$extract(22,999,Line) $ goto CgiVarLoop $ EndCgiVarLoop: $! $ if WWW_WEBSOCKET_INPUT .eqs. "" .or. - WWW_WEBSOCKET_OUTPUT .eqs. "" $ then $ wrsys "status: 500" + crlf $ wrsys crlf $ exit $ endif $! $! (inform the server the script has been successfully activated) $ wrsys "HTTP/1.1 101 Switching Protocols" + crlf $ wrsys crlf $! $ open /read RawSocketInput 'WWW_WEBSOCKET_INPUT' $ open /write RawSocketOutput 'WWW_WEBSOCKET_OUTPUT' $! $ wrwso f$fao("!80*>") + crlf $ wrwso f$environment("procedure") + crlf $ wrwso "Number of times used: ''UsageCount'" + crlf $ wrwso "First used: ''FirstUsed'" + crlf $ wrwso "Now: ''f$time()'" + crlf $ wrwso f$fao("!80*<") + crlf $! $ wrsys f$trnlnm("CGIPLUSEOF") + crlf $! $ close RawSocketInput $ close RawSocketOutput $! $ goto RequestLoop $! $ EndRequestLoop: