blob: 5a27897846dd462854d6fa49be653552add5f30c [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/**
* @assertion int port
* Returns the port used by this socket.
*
* @description Checks that port property returns the port used by this socket
* and different sockets on the same host have different port.
* @author ngl@unipro.ru
*/
import "dart:io";
import "../../../Utils/expect.dart";
check(InternetAddress address) {
asyncStart();
RawDatagramSocket.bind(address, 0).then((producer) {
RawDatagramSocket.bind(address, 0).then((receiver) {
Expect.notEquals(producer.port, receiver.port);
receiver.close();
producer.close();
asyncEnd();
});
});
}
main() {
check(InternetAddress.anyIPv4);
check(InternetAddress.anyIPv6);
check(InternetAddress.loopbackIPv4);
check(InternetAddress.loopbackIPv6);
}