More about Ports
Explore the role of ports in Elixir for integrating external code. Understand message length changes with Unicode, avoid zombie processes caused by improper termination, and apply pooling strategies to manage resources effectively in concurrent environments.
We'll cover the following...
All caps and Unicode
When converting all_caps.exs to use packets, notice we receive the message length, convert the message to all caps, and then compute a new message length. However, you may be wondering:
“Won’t the returned message have the same length as the incoming message?”
The answer might surprise you. Since the String module works on Unicode, it will upcase not only ASCII characters, but also many other characters. One such character is the Latin ligature ff, represented by the codepoint FB00, which occupies three bytes. When converted to ...