Hi, I tried your code, and I noticed that in debugging works properly.
So, i've tried to add this:
Sleep(50);

in the function TSNTPSend.GetSNTP: Boolean;, between these two lines:
  FSock.SendString(FBuffer);
  FBuffer := FSock.RecvPacket(FTimeout);

With this modify, now it works properly any time.

Can you try it too?

Thanks, Mario


2015-07-16 5:22 GMT+02:00 Joshua <joshua__...@hotmail.com>:

> Lukáš Gebauer <gebylist@...> writes:
>
> >
> > Dne 8.1.2015 v 22:06 Simon L napsal(a):
> > > It seems that most NTP servers have been updated recently, which
> > > causes SNTPSend.pas to stop working.
> > >
> >
> > I am tested a few servers now, but all my NTP/SNTP queries working fine.
> > Have you some non-working NTP server for testing?
> >
> > Thanks.
> >
> > ------------------------------------------------------------------------
>
>
> Hi Lukas, I tried 0.pool.ntp.org and 1.pool.ntp.org, both don't seem to
> work, not sure what went wrong?  Thanks.
>
> program Project2;
>
> {$APPTYPE CONSOLE}
>
> uses
>   ExceptionLog,
>   SysUtils, SNTPSend;
>
>   //main proc
>
> var
> sntp :TSNTPSend;
>   remoteTime:TDateTime;
>
> begin
>   sntp:=TSNTPSend.Create;
>   sntp.Timeout:=1;
>   sntp.TargetHost:=ParamStr(2);
>   sntp.SyncTime:=TRUE;
>   writeln('Contacting ' + sntp.TargetHost + ' on port ' +
> sntp.TargetPort);
>   try
>     try
>       if sntp.GetSNTP then
>       begin
>         remoteTime:= sntp.NTPTime;
>         writeln('Remote time is :' + DateTimeToStr(remoteTime)+' UTC');
>       end
>       else
>           writeln('Unable to retrieve remote time');
>     except
>       On E:Exception do WriteLn('Exception ' + E.ClassName + ': ' +
> E.Message);
>     end;
>   finally
>     sntp.Free;
>   end;
> end.
>
> ------------------------------------------------------------------------------
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> _______________________________________________
> synalist-public mailing list
> synalist-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
>
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to