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

[REBOL] Example ports Re:(3)

From: rebol:techscribe at: 7-Sep-2000 22:12

Hi Paul, thanks. I believe http://www.rebol.com/users/netports.html explains the whole thing quite well. Specifically check http://www.rebol.com/users/netports.html#ExchangingMessages Note that the sender port must be closed before the listening port will collect the message and make it available to the print function At 07:50 PM 9/7/00 -0500, you wrote:
>Elan, > > This is fantastic information. This is exactly the kind of information >that should go in the docs. Anyone second the motion? Makes it much >plainer to understand. I didnt know about the close after each send from >the client. > >Paul Tretter > >-----Original Message----- >From: [rebol--techscribe--com] [mailto:[rebol--techscribe--com]] >Sent: Thursday, September 07, 2000 6:36 PM >To: [list--rebol--com] >Subject: [REBOL] Example ports Re: > >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 >
;- 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