Exemple #1
0
        /* Free memory associated with conn */
        M_DestroyConn($conn);
        return;
    }
}
/* Set to blocking mode, means we do not have to
 * do a M_Monitor() loop, M_TransSend() will do this for us */
if (!M_SetBlocking($conn, 1)) {
    echo "Could not set non-blocking mode\r\n";
    /* Free memory associated with conn */
    M_DestroyConn($conn);
    return;
}
/* Set a timeout to be appended to each transaction
 * sent to Monetra */
if (!M_SetTimeout($conn, 30)) {
    echo "Could not set timeout\r\n";
    /* Free memory associated with conn */
    M_DestroyConn($conn);
    return;
}
echo "Connecting to {$MYHOST}:{$MYPORT} using {$MYMETHOD}...";
/* Connect to Monetra */
if (!M_Connect($conn)) {
    echo "Connection failed: " . M_ConnectionError($conn) . "\r\n";
    /* Free memory associated with conn */
    M_DestroyConn($conn);
    // free memory
    return;
}
echo "connected\r\n";
 function MCVE_SetTimeout(&$conn, $secs)
 {
     return M_SetTimeout($conn, $secs);
 }