<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div>your examples are now viewable in markdown at github here: <a target="_blank" href="https://github.com/gettimothy/Org-SmalltalkSockets/blob/main/SmalltalkSockets.md">https://github.com/gettimothy/Org-SmalltalkSockets/blob/main/SmalltalkSockets.md</a><br></div><div><br></div><div>And available as CustomHelp at squeaksource.com/Doc<br></div><div><br></div><div><br></div><div><br></div><div class="zmail_extra_hr" style="border-top: 1px solid rgb(204, 204, 204); height: 0px; margin-top: 10px; margin-bottom: 10px; line-height: 0px;"><br></div><div class="zmail_extra" data-zbluepencil-ignore="true"><br><div id="Zm-_Id_-Sgn1">---- On Fri, 15 Oct 2021 09:17:50 -0400 <b>Marcel Taeumel <marcel.taeumel@hpi.de></b> wrote ----<br></div><br><blockquote style="margin: 0px;"><div><div id="x_615022236__MailbirdStyleContent" style="font-size :  10pt; font-family :  Arial; color :  #000000; text-align :  left;" dir="ltr">Hi Herbert --<div><br></div><div>Thanks for the tip.<br></div><div><br></div><div>The example I provided should rather serve as a starting point to have a look at the proper classes and methods. It's details should not be treated as best practice. There can be other values or messages better suited for the job. It is advisable to use the Senders/Implementors tools to locate more examples in the environment.<br></div><div><br></div><div>Best,<br></div><div>Marcel<br></div><div class="x_615022236mb_sig"><br></div><blockquote class="x_615022236history_container" style="border-left-style :  solid; border-width :  1px; margin-top :  20px; margin-left :  0px; padding-left :  10px; min-width :  500px;"><p style="margin-top: 10px;"><span class="colour" style="color: rgb(170, 170, 170); margin-top: 10px;">Am 15.10.2021 15:12:49 schrieb Herbert König <<a href="mailto:herbertkoenig@gmx.net" target="_blank">herbertkoenig@gmx.net</a>>:</span><br></p><div style="font-family :  Arial, Helvetica, sans-serif;">Hi Marcel,<br> <br> to my best knowledge the first 32K of 64K possible ports are
    occupied. <a class="x_615022236moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers" target="_blank">https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers</a><br> So if you randomly choose one of them, you might get conflicts with
    a service running on your computer on that port.<br> <br> I always use port numbers at the upper end of the range. <br> <br> Looking at the above page port 1234 is assigned by IANA to the
    infoseek search agent and unofficially used by the VNC client. <br> <br> Cheers,<br> <br> Herbert<br> <br> <div class="x_615022236moz-cite-prefix">Am 15.10.2021 um 14:19 schrieb Marcel
      Taeumel:<br></div><blockquote style="min-width :  500px;"><div id="x_615022236__MailbirdStyleContent" style="font-size :  10pt; font-family :  Arial; color :  #000000; text-align :  left;" dir="ltr">Hi Timothy -- <div><br></div><div>Sockets work something like this (even though network name
          resolving seems to be tricky on my Windows machine at the
          moment):<br></div><div><br></div><div><div><span class="size" style="font-size:13.3333px">| hostName port
              serverSocket serverProcess clientSocket |</span><br></div><div><span class="size" style="font-size:13.3333px"><br></span></div><div><span class="size" style="font-size:13.3333px">hostName :=
              NetNameResolver localHostName.</span><br></div><div><span class="size" style="font-size:13.3333px">port := 1234.</span><br></div><div><span class="size" style="font-size:13.3333px">data := 'Hello
              World!'.</span><br></div><div><span class="size" style="font-size:13.3333px"><br></span></div><div><span class="size" style="font-size:13.3333px">serverSocket := Socket
              newTCP.</span><br></div><div><span class="size" style="font-size:13.3333px">serverSocket listenOn:
              port.</span><br></div><div><span class="size" style="font-size:13.3333px"><br></span></div><div><span class="size" style="font-size:13.3333px">serverProcess := [</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>|
              receivedData |</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>serverSocket
              waitForConnectionFor: 10 "seconds".</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>Transcript
              showln: 'Server accepted client connection'.<span style="white-space :  pre;"></span></span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>receivedData
              := serverSocket receiveData.</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>Transcript
              showln: 'Data received: ', receivedData.</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>serverSocket
              closeAndDestroy.</span><br></div><div><span class="size" style="font-size:13.3333px">] newProcess.</span><br></div><div><span class="size" style="font-size:13.3333px">serverProcess
              priority: Processor userBackgroundPriority.</span><br></div><div><span class="size" style="font-size:13.3333px">serverProcess resume.
              "or use #forkAt: directly on block"</span><br></div><div><span class="size" style="font-size:13.3333px"><br></span></div><div><span class="size" style="font-size:13.3333px">clientSocket := Socket
              newTCP.</span><br></div><div><span class="size" style="font-size:13.3333px">clientSocket</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>connectTo:
              (NetNameResolver addressFromString: hostName)</span><br></div><div><span class="size" style="font-size:13.3333px"><span style="white-space :  pre;"></span>port:
              port.</span><br></div><div><span class="size" style="font-size:13.3333px">Transcript showln:
              'Client connected to server'.</span><br></div><div><span class="size" style="font-size:13.3333px"><br></span></div><div><span class="size" style="font-size:13.3333px">Transcript showln:
              'Data sent: ', (clientSocket sendData: data), ' bytes'.</span><br></div><div><span class="size" style="font-size:13.3333px">clientSocket
              closeAndDestroy.</span><br></div></div><div><span class="size" style="font-size:13.3333px"><br></span></div><div><span class="size" style="font-size:13.3333px">Best,</span><br></div><div><span class="size" style="font-size:13.3333px">Marcel</span><br></div><blockquote class="x_615022236history_container" style="border-left-style :  solid; border-width :  1px; margin-top :  20px; margin-left :  0px; padding-left :  10px; min-width :  500px;"><p style="margin-top: 10px;"><span class="colour" style="color: rgb(170, 170, 170); margin-top: 10px;">Am 15.10.2021
            13:34:07 schrieb gettimothy <a class="x_615022236moz-txt-link-rfc2396E" href="mailto:gettimothy@zoho.com" target="_blank"><gettimothy@zoho.com></a>:</span><br></p><div style="font-family :  Arial, Helvetica, sans-serif;"><div style="font-family :  Verdana,  Arial,  Helvetica,                sans-serif; font-size :  10pt;"><div><br></div><div>Marcel,<br></div><div><br></div><div>Thank you.<br></div><div><br></div><div>I have not found any information on sockets in SBE or
                PBE.  I will continue too look.<br></div><div><br></div><div>In my exploring, I thought JSON looked
                promising..pharo as a json server thingy that perhaps
                squeak could consume.<br></div><div>IIRC Stomp, which I have used previously on squeak
                has two side too, but I am not sure on this.<br></div><div><br></div><div>cheers,<br></div><div><br></div><div>t<br></div><div><br></div><div class="x_615022236zmail_extra_hr" style="border-top :  1px solid rgb(204, 204, 204); min-height:  0px; margin-top :  10px; margin-bottom :  10px; line-height :  0px;"><br></div><div class="x_615022236zmail_extra"><br><div id="x_615022236Zm-_Id_-Sgn1">---- On Fri, 15 Oct 2021 04:16:35
                  -0400 <b>Marcel Taeumel <a class="x_615022236moz-txt-link-rfc2396E" href="mailto:marcel.taeumel@hpi.de" target="_blank"><marcel.taeumel@hpi.de></a></b> wrote ----<br></div><br><blockquote style="margin :  0px; min-width :  500px;"><div><div id="x_-27494605__MailbirdStyleContent" style="font-size :  10pt; font-family :  Arial; color :  #000000; text-align :  left;" dir="ltr">Hi Timothy -- <div class="x_-27494605mb_sig"><br></div><div><br></div><div>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.<br></div><div><br></div><div>Maybe you could also use a file and two file
                        streams, a writer in Pharo and a reader in
                        Squeak, as intermediary ...<br></div><div><br></div><div>Best,<br></div><div>Marcel<br></div><blockquote class="x_-27494605history_container" style="border-left-style :  solid; border-width :  1px; margin-top :  20px; margin-left :  0px; padding-left :  10px; min-width :  500px;"><p style="margin-top :  10px;"><span class="x_615022236colour" style="margin-top :  10px;">Am 14.10.2021
                            15:24:23 schrieb gettimothy via Squeak-dev
                            <<a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>>:</span><br></p><div style="font-family  :  Arial,  Helvetica,                            sans-serif;"><div style="font-family :  Verdana,  Arial,                              Helvetica,  sans-serif; font-size :  10pt;"><div>Hi Folks,<br></div><div><br></div><div><br></div><div>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.<br></div><div><br></div><div><br></div><div>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)  .<br></div><div><br></div><div>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.<br></div><div><br></div><div>Communication  I would like is  pharo
                              (sax) -> squeak(xtreams-parsing).<br></div><div><br></div><div>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.<br></div><div>I have used neither of them.<br></div><div><br></div><div>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.<br></div><div><br></div><div><br></div><div><br></div><div>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.<br></div><div><br></div><div>thx in advance.<br></div><div><br></div></div><br></div></blockquote></div><br></div></blockquote></div><div><br></div></div><br></div></blockquote></div><br><pre class="x_615022236moz-quote-pre"><br></pre></blockquote><br></div></blockquote></div><br></div></blockquote></div><div><br></div></div><br></body></html>