Results 1 to 1 of 1

Thread: QTcpServer or QUdpLocal, can't bind to IPv6 link-local

  1. #1
    Join Date
    Feb 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default QTcpServer or QUdpLocal, can't bind to IPv6 link-local

    Hi there.

    I am trying to bind (QUdpSocket) or listen (QTcpServer) to an IPv6 link-local address.

    The address was retrieved via QNetworkInterface::allAddresses().

    When I call QTcpServer::listen() or QUdpSocket::bind() on that QHostAddress, I get the error: "The address is not available"

    Now I understand that to bind on an IPv6 link-local address, you have to set the scopeId as well.
    Eg, for the link-local fe80::ca2a:14ff:fe3f:232 , you need to use fe80::ca2a:14ff:fe3f:232%en0

    Interestingly, calling QHostAddress::scopeId(), returns an empty string, I think it should have been set to "en0" automatically here.

    I have to manually set the scopeId to what it should be (e.g. QHostAddress::setScopeId("en0").

    So, what is the proper way to set a server to listen on an IPv6 link-local addres??
    Or at least, how do I retrieve the scopeId of a link-local address, or find the matching network interface for a given IP (then I can call setScopeId myself)

    Thanks in advance
    Jean-Yves
    Last edited by jyavenard; 1st May 2012 at 13:05.

Similar Threads

  1. IPv6 on Linux using QServerSocket()
    By Adelaide in forum Qt Programming
    Replies: 0
    Last Post: 22nd March 2012, 09:13
  2. Validation of IPv6 Address in QT4
    By doggrant in forum Qt Programming
    Replies: 0
    Last Post: 26th September 2011, 12:39
  3. Replies: 11
    Last Post: 5th May 2011, 15:05
  4. Replies: 1
    Last Post: 19th April 2010, 00:47
  5. Replies: 1
    Last Post: 18th June 2006, 11:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.