mattbaker

mattbaker

I’m having so much fun working on the “Protohackers” challenges, I never got into Advent of Code much but this has been amazing. The challenges are all centered around protocols, so far they’ve all required you build a TCP server (gen_tcp makes it easy).

Also it’s an area Erlang/Elixir really excels at, so it’s fun to build lower level things that leverage all the great Erlang stuff, something I don’t think most of us get to do too often! Good opportunities to play with gen_tcp, messing with bits and bytes, and using binary pattern matching.

There’s an elixir channel in the protohacker discord if you decide to jump in! :slight_smile:

Couple last things to mention:

  • ngrok doesn’t work, it seems to mess with TCP traffic, so I opened a port in my firewall and forwarded it to my laptop, then I provided that port along with my public IP. I liked that because I didn’t have to bother deploying my app to a VPS/Fly.io/etc. I just closed the port when I was done.
  • The Elixir intro actually has a section where you implement an echo server with gen_tcp, it’s perfect for getting started.

First 10 of 21 Posts Switch mode

NobbZ

NobbZ

What you say sounds interesting, though the link you gave gives me a fat red warning that the certificate was invalid…

Ignoring it in a sandboxed Browser just shows “ok”…

mattbaker

mattbaker OP

Weird :thinking: No cert issues here, my browser is showing a valid cert issued by Let’s Encrypt.

I did update the URL, I had “/results” on there by accident (doesn’t explain your TLS issue though)

NobbZ

NobbZ

The cert I see is for api.protohackers.com, not including the upper level or any siblings.

LostKobrakai

LostKobrakai

I have the same issue, but it was fine earlier yesterday (before this thread was posted). Feels like there’s still some development happening any maybe something got misconfigured.

NobbZ

NobbZ

Between “first coffee” and “first coffee in office” something seems to have changed and now it works for me.

Lets assume there have been propagation or configuration issues.

As they posted problem 2 recently, the site doesn’t seem to be very old.

lud

lud

I don’t understand the smoke test. What do they mean with “end of file”? I receive data and send it back, but then they close the connexion.

So that works with test content.0 but not content.1 but I can’t figure out what they want. Any help?

NobbZ

NobbZ

EOF is when the stream ends. Traditionally socket implementations will give you EOL at least once when you try to read from a socket that has been closed by the other side.

lud

lud

Well the problem is unclear. If they close the socket I cannot echo back … And they say we must collect all the data they send before sending back. Anyway, buffer or not it does not work. Maybe my tunnel is bad, though it passes the first test.

NobbZ

NobbZ

If they close their end, you still have your end. Thats why they say in the FAQ that you can’t use ngrok for the smoke test.

mattbaker

mattbaker OP

If you push up a repo with your code somewhere I’d be happy to take a look.

Lots of people free to help on the Discord too :slight_smile: There are channels for each problem.

Where Next? Top

Trending in Challenges Top

Other Trending Topics Top

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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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

We're in Beta

About us Mission Statement