I found a solution for the broadcasting, the old code works, the only problem was sending a package, this code seems to work for me:
netAddress = NetAddress()
netAddress.setAny( self.udpPort )
package = PyDatagram()
package.addUint16( messageId )
package.addString( data )
self.qcWriter.send( package, self.udpConnection, netAddress )