Code Duplication    Length = 13-13 lines in 2 locations

scripts/daemon-spotter.php 2 locations

@@ 76-88 (lines=13) @@
73
if ($globalDebug) echo "Connecting...\n";
74
$use_aprs = false;
75
76
function create_socket($host, $port, &$errno, &$errstr) {
77
    $ip = gethostbyname($host);
78
    $s = socket_create(AF_INET, SOCK_STREAM, 0);
79
    $r = @socket_connect($s, $ip, $port);
80
    if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
81
    if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
82
        return $s;
83
    }
84
    $errno = socket_last_error($s);
85
    $errstr = socket_strerror($errno);
86
    socket_close($s);
87
    return false;
88
}
89
90
function create_socket_udp($host, $port, &$errno, &$errstr) {
91
    echo "UDP !!";
@@ 90-102 (lines=13) @@
87
    return false;
88
}
89
90
function create_socket_udp($host, $port, &$errno, &$errstr) {
91
    echo "UDP !!";
92
    $ip = gethostbyname($host);
93
    $s = socket_create(AF_INET, SOCK_DGRAM, 0);
94
    $r = @socket_bind($s, $ip, $port);
95
    if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
96
        return $s;
97
    }
98
    $errno = socket_last_error($s);
99
    $errstr = socket_strerror($errno);
100
    socket_close($s);
101
    return false;
102
}
103
104
function connect_all($hosts) {
105
    //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;