Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Example ports Re:

From: rebol:techscribe at: 7-Sep-2000 16:35

Hi Paul, Assume two REBOL processes (i.e. you launch REBOL twice on the same machine, or on two different machines connected by TCP/IP. I assume same machine here and use local host setting, 127.0.01 for the client.) REBOL process 1: will be indicated by prompt 1>> REBOL process 2: will be indicated by prompt 2>> Simple Session: 1>> server: open/lines tcp://:8000 2>> client: open/lines tcp://127.0.0.1:8000 2>> insert client "Hi, there." 2>> close client 1>> port: first server 1>> print first port Hi, there. BETTER use copy to prevent data loss on server side: 1>> port: first server 1>> print copy port Hi, there. Complex (Bi-directional) Session: 1>> server: open tcp://:8000 1>> input-buffer: make string! 1024 1>> while [true] [ 1>> server-port: first server 1>> while [true] [ 1>> wait server-port 1>> read-io server-port input-buffer 1024 1>> break 1>> ] 1>> print input-buffer 1>> insert server-port join input-buffer [" from server."] 1>> clear input-buffer 1>> close server-port 1>> ] 2>> message:" Client here. " 2>> client: open tcp://127.0.0.1:8000 2>> insert client message 2>> print copy client 2>> close client Note that once you have sent something on a client port, you must close the client port and open it again, before you can send more stuff out that port. At 05:27 PM 9/7/00 -0500, you wrote:
>Can someone provide an example of sending something to a port and how to >know if you are getting a response. > >Paul Tretter >
;- Elan [ : - ) ] author of REBOL: THE OFFICIAL GUIDE REBOL Press: The Official Source for REBOL Books http://www.REBOLpress.com visit me at http://www.TechScribe.com