Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:42:36+00:00 2026-06-08T01:42:36+00:00

TLDR: Does there exist reusable code for automatically reconnecting to a TCP server that

  • 0

TLDR: Does there exist reusable code for automatically reconnecting to a TCP server that sometimes fails?


I’m writing a server application — call it hal — that also opens some TCP connections to other servers — among them xbmc. I had originally written it so that when xbmc failed, the xbmc erlang process would stop and subsequently be restarted by its supervisor.

Apparently, this is not a good way to do persistent TCP connections in erlang. First of all, it doesn’t really work: When xbmc failed, the processs would restart too quickly, and the supervisor would shut down the entire hal program. Secondly, I am apparently not supposed to use the supervisor for this: Erlang Supervisor Strategy For Restarting Connections to Downed Hosts (As I read it, this linked question only answers “does supervisor solve this?”, and is not a duplicate of my question)

I’m thinking this sounds like a reasonably common use case, keeping a TCP connection as connected as possible even with a host that goes down now and then. Is there some OTP or other library code I should use to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:42:37+00:00Added an answer on June 8, 2026 at 1:42 am

    No, there’s nothing in OTP that does this for you.

    I would say that given the number of times I’ve written this myself, it’s high time for a decent connection management library to be written. Particularly one that considers a recent history of connection attempts and results, can be given an endpoint address (hostname and port) and use multiple addresses returned from the hostname lookup to perform fast failover for endpoints that have multiple destinations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if (reader.is_lazy()) goto tldr; I have a background thread that does some I/O-intensive background
TLDR: How do I call standard floating point code in a way that compiles
I have the following Ext.getElementById call from a specific part of application code, that
I'm writing a program that searches directories of a computer. On my own computer
I have a computed column in MS SQL 2005 that does some VAT calculations.
TLDR; How to open a magnet link like magnet:?xt=blablablabl with the default application on
TLDR: Does anyone have experience of both protovis & D3.js to illuminate the differences
tldr: Why does ('placeholder' in inputElemnt) equal true in IE8 despite no native support
TLDR: if I built a multipurpose parser by hand with different code for each
I am writing a program in C# that needs to support undo/redo. For this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.