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.

Showing Posts 1 to 10

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

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
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

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews