Skip to content

bindPort{TCP,Gen,GenEx} only accepts numeric hostnames  #46

@TravisCardwell

Description

@TravisCardwell

A colleague recently discovered that he is unable to use Warp with hostnames (such as "localhost"); it only works with IP addresses.

  1. runSettings calls bindPortTCP (source)
  2. bindPortTCP calls bindPortGen (source)
  3. bindPortGen calls bindPortGenEx (source)
  4. bindPortGenEx sets the NS.AI_NUMERICHOST hint (source), which limits hosts to numeric addresses

Is this a desired limitation? If so, perhaps it should be documented, as none of the above functions have documentation that mentions it. If not, would removing the NS.AI_NUMERICHOST hint be an acceptable fix, or would that have undesired consequences for other uses of the function?

Note that the limitation can be easily worked around by resolving hostnames before configuring the Warp settings.

For anybody who runs across this issue and searches for it, here is the error message:

Network.Socket.getAddrInfo (called with
preferred socket type/protocol: AddrInfo
  { addrFlags = [AI_PASSIVE,AI_NUMERICSERV,AI_NUMERICHOST]
  , addrFamily = AF_UNSPEC
  , addrSocketType = Stream
  , addrProtocol = 0
  , addrAddress = <assumed to be undefined>
  , addrCanonName = <assumed to be undefined>
  },
host name: Just "localhost",
service name: Just "8000"):
does not exist (Name or service not known)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions