Using fuel should be way faster than plain textual serialization. A direct copy of memory would be theoretically faster but you would need to manage references anyway so it is not clear what can be gained. Norbert
Am 17.11.2014 um 11:05 schrieb Annick Fron <list@afceurope.com>:
Thank you, My need is on a local network from machine to machine, in real time is possible, so no security involved. I would have preferred something more performant than web services or XMLRPC, since both serialization and XML serialization are slow. Annick Le 13 nov. 2014 à 20:17, Sven Van Caekenberghe <sven@stfx.eu> a écrit :
Nice.
It is of course also important to note the security risks involved: the client can execute absolutely anything.
One partial solution is to bind the server only to the localhost.
On 13 Nov 2014, at 19:17, Alain Rastoul <alf.mmm.cat@gmail.com> wrote:
Hi, CORBA main focus is about interoperability between systems, languages (don't know about opentalk). If you want smalltalk only remote execution, you can very easily do your own on Pharo with Zinc http components and Fuel serializer: a small server that reads smalltalk blocks, evaluates them and return the result (see below an example of server and client). I don't know if Zinc and Fuel run on Squeak, but I guess if not, they are equivalents ones or you could do the same. Beware that Fuel builds a graph of the objects touched by the object it serializes (the block) and serialize them along the way, that may be a problem if you have references to other big objects of your image.
" ================================= RPC server" " start Zn server in background " ZnServer startDefaultOn: 1701. ZnServer default delegate: (ZnWebSocketDelegate handler: ([ :webSocket | [ [ | serializedRequest request response serializedResponse | serializedRequest := webSocket readMessage. request := FLMaterializer materializeFromByteArray: serializedRequest. "execute block and it's value to response byte array" response := [ request value ] on: Exception do: [ :ex | ex resume: 'Exception ',ex class name , ' - ', ex messageText ]. serializedResponse := FLSerializer serializeToByteArray: response . webSocket sendMessage: serializedResponse . ] repeat. ] on: ConnectionClosed, ConnectionTimedOut do: [ self crLog: 'Ignoring connection or timeout' ] ]) ). "========================================="
" to stop the server" ZnServer stopDefault .
"========================================= RPC CLIENT"
" Client call to server: calculate factorial 100 on the other side" | webSocket | webSocket := ZnWebSocket to: 'ws://127.0.0.1:1701'. [ | request serializedRequest serializedResponse response | request := [ 100 factorial ] . " the request is the block to evaluate" serializedRequest := FLSerializer serializeToByteArray: request . "serialize the block" webSocket sendMessage: serializedRequest . "send it" serializedResponse := webSocket readMessage . " read response" response := FLMaterializer materializeFromByteArray: serializedResponse. "deserialize to object" Transcript show: response asString ; cr ] on: ConnectionClosed do: [ self crLog: 'Ignoring connection close, done' ]
regards,
Alain
Le 12/11/2014 18:17, Annick Fron a écrit :
Hi,
Are there some libraries in pharo to do remote calls like in Opentalk or Corba ?
Annick