Pharo Networking by Example

On March 8th 2011, I gave a hands on talk on Pharo Networking.  It was part of the Deep into Smalltalk sprint school organized by RMoD team from INRIA in Lille, France.  You can find below slides are available on SlideShare. There is as well a 3 parts video from Youtube, although the audio is not so great.

Most of the content from the talk is still valid in the latest version of Pharo. But, I suggest to use the NetworkExtras project available on my PharoMisc GitHub repository.  It provides facility classes for TCP and UDP as well as support for various kinds of UDP (unicast, multicast, broadcast) and other stuff regarding port management and large UDP datagrams.

Tip: Use Dedicated Processes

One thing to keep in mind is that socket commands you run from a Pharo Playground run in the main process. So, you need ensure that servers and clients that belong to the same image run in different processes.

To create a process in Pharo, just put your statements in a block and send the forkAt: message. The argument is a process priority.  Here is an example.

[
  10 timesRepeat: [
    Transcript
      cr;
      show: 'Hello Pharo Networking' 
   ] 
] forkAt: Processor userBackgroundPriority

Free Book Chapter on Sockets

In the Deep into Pharo book published in 2013, there is a chapter dedicated to Pharo Networking. It’s entitled Sockets. The PDF of book can be downloaded for free from the Pharo books web site.

Slides of the Talk

3 Parts Video of the Full Talk

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.