Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!csc.ti.com!ti-csl!tilde.csc.ti.com!ticipa!ticipa!rick From: rick@foghorn.ti.com (Rick Carlos) Newsgroups: comp.lang.smalltalk Subject: Re: Distributing Objects in Smalltalk-80 r4.0 Message-ID: Date: 12 Jun 91 21:33:49 GMT References: Sender: usenet@ticipa.pac.sc.ti.com (USENET News System) Distribution: comp.lang.smalltalk Organization: Texas Instruments Process Automation Center Lines: 82 In-Reply-To: metzger@t500m0.ira.uka.de's message of 10 Jun 91 13: 42:21 GMT In article metzger@t500m0.ira.uka.de (Metzger Rolf) writes: > > 2.) To save a complex object structure, I have the BOSS > (Binary Object Streaming Service) of the Advanced > Programming Toolkit. I have some problems to use it > with an ExternalConnection and a ReadAppendStream. > Does anyone have an example for me, how to communicate > on Unix-Sockets and ReadAppendStreams with BOSS ? > The following works for me: client side: ----------- START SETUP ... "connect to the transport address - socket abstraction" aClientSocket := UnixSocketAccessor newTCPclientToHost: hostName port: port. "stream abstraction on top of socket" binaryStream := (ExternalConnection new input: aClientSocket; output: aClientSocket) readAppendStream. "bos abstraction on top of stream" wbos := BinaryObjectStorage onNew: binaryStream. binaryStream commit. rbos := BinaryObjectStorage onOldNoScan: binaryStream. ... END SETUP START PROXY ... "send a message" wbos nextPut: aMessage. binaryStream commit. "synchronously wait for the answer" (rbos atEnd) ifTrue: [ "peer closed down" binaryStream close. ... ]. "receive the answer" theAnswer := rbos next. ... END PROXY server side: ----------- START SETUP ... serverSocket := UnixSocketAccessor newTCP. serverSocket listenFor: 5. ... clientSocket := serverSocket accept. ... "stream abstraction on top of socket" binaryStream := (ExternalConnection new input: clientSocket; output: clientSocket) readAppendStream. "bos abstraction on top of stream" rbos := BinaryObjectStorage onOldNoScan: binaryStream. wbos := BinaryObjectStorage onNew: binaryStream. binaryStream commit. ... END SETUP START AGENT ... [rbos atEnd] whileFalse: [ "receive a message" aMessage := rbos next. ... "send the answer" wbos nextPut: theAnswer. binaryStream commit. ]. "peer closed down" binaryStream close. ... END AGENT -- Rick Carlos Internet: rick@foghorn.pac.sc.ti.com Texas Instruments, Inc. UUCP: ti-csl!ticipa!rick P.O. Box 655012 Voice: (214)917-2220 MS 3635 TI-MSG: FSIC Dallas, Tx. 75265 TI-DECNET: ticipa::rick