Hi!
I try to connect to a host using broadcast and bind the connected port to receive a message.

With Qt3 QSocketDevice it worked fine doing this:
Qt Code:
  1. address.setAddress( "255.255.255.255" );
  2. socket->setAddressReusable( true );
  3. socket->connect( address, 8080 );
  4.  
  5.  
  6. address.setAddress( "0.0.0.0" );
  7. socket2->setBlocking( false );
  8. socket2->setAddressReusable( true );
  9. socket2->bind( address, socket->port() );
  10. const char *msg = "my_message";
  11. socket->writeBlock( msg, strlen(msg) );
To copy to clipboard, switch view to plain text mode 

I tried with QUdpSocket
Qt Code:
  1. address.setAddress( "255.255.255.255" );
  2. socket->connectToHost( address, 8080 );
  3.  
  4. address.setAddress( "0.0.0.0" );
  5.  
  6. printf("bind: %i\n",socket2->bind( socket->localPort(),QUdpSocket::ReuseAddressHint|QUdpSocket::ShareAddress ));
  7. printf("error %i: %s\n",socket2->error(),socket2->errorString().ascii());
  8.  
  9. const char *msg = "my_message";
  10. socket->write( msg, strlen(msg) );
To copy to clipboard, switch view to plain text mode 
I cannot bind the receiving socket.
I tried it on windows:
"error 3: The address is protected."
and on linux:
"error 8: The bound address is already in use"


Any ideas how to get this to work?