rlopzc

rlopzc

Blog Post: Elixir FTP Client: GenServer - Part 1

Learn how to leverage Erlang + Elixir’s GenServer to build a robust FTP Client.

https://rlopzc.com/posts/elixir-ftp-client-genserver-part-1/

First Post! Switch mode

mudasobwa

mudasobwa

Creator of Cure

Well put! The only thing that bugs me is this code would suffer crashes operating against slow ftp servers. The code below would blow up if there is no response for :ftp.ls/0 is 5 seconds.

def ls do
  GenServer.call({:global, __MODULE__}, :ls)
end

I would probably put a greater timeout or even :infinity there.

Most Liked

adamu

adamu

I think it would be useful to include automated tests, as especially for clients and GenServers, this is likely to considerably change the design.

D4no0

D4no0

No, we were strictly using passive mode, it would be extremely annoying to set the infrastructure to allow incoming connections.

We did have an issue where data transfer would not work. There was a misconfigured ftp server behind a proxy that would send its local IP for data connections, but send the correct public one for commands, so it would work until you wanted to make file transfers. What I ended up doing was to extract the ftp library from OTP, mass rename it and change the library to always fetch the IP from the initial command connection for data connections.

I don’t remember exactly how I found out the exact issue, but I think it was by running ftp in verbose mode, it literally shows all the steps it takes if I remember correctly.

Where Next?

Trending in Blog Posts Top

bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
ryanzidago
Hi all, In this article, I make the case for each test owning its setup. Usually I forbid my AI agents to use the setup callbacks; I mu...
New
zorn
As I’ve leaned into AI code generation on LocalCents, the volume I ship has climbed, and my worry shifted from any single change to the l...
New
jswanner
I wrote about an issue I had with a LiveView application, and how I solved the problem by debouncing updates server-side (within the Live...
New
abreujp
I’ve published a new article in my Elixir learning series on dev.to exploring what happens when tagged tuples aren’t enough - the try, re...
New
zorn
A recent ex_money v6 upgrade was blocked because Timex pins an old gettext. Rather than one big remove-and-rewrite PR, I used a shim: a m...
New
pckrishnadas88
This article demonstrates how to build a minimal stateful process using only Elixir’s core concurrency primitives: spawn/1, send/2, recei...
New

Other Trending Topics Top

beepbeepbopbop
SuperAPI will be hosting the Melbourne Elixir meetup this Thursday, August 6th. The event will be held at Level 2, 525 Collins St (Rialto...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement