PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Using Ports for Time Servers

As with every protocol within the world wide web, the NTP and SNTP protocols use standard ports. NTP uses port 123 and SNTP uses port 37.

But sometimes the port that the protocols use differs from the standard one. You can define the port which has to be used for each server within the address. Just add the number of the port after the address. If no port is defined, then Zend_TimeSync will use the standard port.

<?php
$server 
= new Zend_TimeSync(array('generic'  => 'ntp:\\0.pool.ntp.org:200',
                                  
'fallback' => 'ntp:\\1.pool.ntp.org'));
$server->addServer('sntp:\\internal.myserver.com:399''additional');

print 
$server->getDate()->getIso();

Zend Framework