[squeak-dev] inter-image communication and queueing suggestions?
gettimothy
gettimothy at zoho.com
Fri Oct 15 12:32:40 UTC 2021
Thank you.
I was able to make the last example here: http://wiki.squeak.org/squeak/325 work.
For some reason, using UDP throws an error, I do not know why, and of course, I will waste time trying to figure out why.
I will give your example a go next!
Then, I will try the pharo->squeak send.
this is fun!
Thank you.
---- On Fri, 15 Oct 2021 08:19:35 -0400 Marcel Taeumel <marcel.taeumel at hpi.de> wrote ----
Hi Timothy --
Sockets work something like this (even though network name resolving seems to be tricky on my Windows machine at the moment):
| hostName port serverSocket serverProcess clientSocket |
hostName := NetNameResolver localHostName.
port := 1234.
data := 'Hello World!'.
serverSocket := Socket newTCP.
serverSocket listenOn: port.
serverProcess := [
| receivedData |
serverSocket waitForConnectionFor: 10 "seconds".
Transcript showln: 'Server accepted client connection'.
receivedData := serverSocket receiveData.
Transcript showln: 'Data received: ', receivedData.
serverSocket closeAndDestroy.
] newProcess.
serverProcess priority: Processor userBackgroundPriority.
serverProcess resume. "or use #forkAt: directly on block"
clientSocket := Socket newTCP.
clientSocket
connectTo: (NetNameResolver addressFromString: hostName)
port: port.
Transcript showln: 'Client connected to server'.
Transcript showln: 'Data sent: ', (clientSocket sendData: data), ' bytes'.
clientSocket closeAndDestroy.
Best,
Marcel
Am 15.10.2021 13:34:07 schrieb gettimothy <mailto:gettimothy at zoho.com>:
Marcel,
Thank you.
I have not found any information on sockets in SBE or PBE. I will continue too look.
In my exploring, I thought JSON looked promising..pharo as a json server thingy that perhaps squeak could consume.
IIRC Stomp, which I have used previously on squeak has two side too, but I am not sure on this.
cheers,
t
---- On Fri, 15 Oct 2021 04:16:35 -0400 Marcel Taeumel <mailto:marcel.taeumel at hpi.de> wrote ----
Hi Timothy --
If it is just a text stream, use sockets. If it is a data/byte stream ... well ... I am not sure whether the byte interpretation for structured objects is still compatible between Pharo and Squeak.
Maybe you could also use a file and two file streams, a writer in Pharo and a reader in Squeak, as intermediary ...
Best,
Marcel
Am 14.10.2021 15:24:23 schrieb gettimothy via Squeak-dev <mailto:squeak-dev at lists.squeakfoundation.org>:
Hi Folks,
I have used ApacheMQ(?) and Stomp in squeak to communicate between squeak and a C++ application, it worked well, but I would like to avoid this for my project.
What I (will) have is a pharo image that will parse a large XML document for me (squeak has FileSystem incompatabilities that SAXHandler etc need) .
During a SAXHandler callback, I want to kick this to an image that will parse some data using a PEG grammar I wrote and that needs some automated testing to perfect.
Communication I would like is pharo (sax) -> squeak(xtreams-parsing).
Some basic reading showed rST from about 2005? as a possibility as well as Nebraska,which I believe has been removed from Squeak several releases ago.
I have used neither of them.
If there is not a method I can make work, then I will do pharo(sax/stomp)->ApacheMQ->squeak(stomp/xtreams-parsing), but I prefer a pure smalltalk mechanism.
I still have a textbook of mpq(?) queues from a course I really enjoyed and pharo(sax)->squeak(queueing)->squeak(xtreams-parsing) would be really cool.
thx in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211015/f20282a3/attachment.html>
More information about the Squeak-dev
mailing list
|