Menu

TCPSocket and INETADDR_ANY

2000-11-30
2000-12-20
  • Alexander Ehlert

    Hi,

    would it be possible to include a feature allowing to bind the TCPSocket with addr.sin_addr = INETADDR_ANY instead to only one single device?

    Alex

     
    • Alexander Ehlert

      Ok,

      as usual I should have tried harder first (and it's INADDR_ANY).
      Anyway with the right constructor it works. But on the other hand it would be nicer to do

              InetHostAddress server(NULL);

      instead of

              addr.sin_addr.s_addr = INADDR_ANY;
              addr.sin_family = AF_INET;
              addr.sin_port = htons(4711);

              InetHostAddress server(addr.sin_addr);

      Or have a special constructor for InetAddress and a constructor
      for TCPSocket that just takes InetAddress.

      Cheers, Alex

       
      • Robert Prouse

        Robert Prouse - 2000-12-20

        In the latest code in the repository this has been done.  You can now do

        InetHostAddress server;

        Which will create it with INADDR_ANY.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.