Retrieving Date & Time from a web server (localhost)

I'm developing a software (a WinApp, not a WebApp)
to retrieve Date & Time from a web server,
but firstly I need to to test it on my PC, with "localhost"

I'm using the VB Net language
(below two different code approaches),
I'm with XP Sp2 and IIS
(all IIS http and ftp tasks regularly work)

I have no firewall
I think it maybe a matter of Service enabling
(maybe involving the port 13...)

Any attempt fail.


1 approach)
using the following VB Net API

Private Declare Unicode Function NetRemoteTOD Lib "netapi32" ( _
<MarshalAs(UnmanagedType.LPWStr)> ByVal ServerName As String, _
ByRef BufferPtr As IntPtr) As Integer

the entire example here:
http://www.codeproject.com/KB/vb/NetRemoteTOD.aspx?fid=31067 &df=90&mpp=25&noise=3&sort=Position&view=Quick&select=707715 #xx707715xx

tried using

"localhost"
"http//localhost"
"127.0.0.1"

but always got 00.00.00.00





2 approach)
using this VB Net command

Dns.GetHostByName("localhost")

it seems to work because no error occurs
(if I wrote "localhostSharonStone" an error occurs),

but the very next command it does fail:
objTcpClient.Connect("localhost", 13)

it says (translated into English)
"Impossible to establish a connection. The addressed computer
keeps on refusing".




Any hint?
TEO [ Mo, 14 April 2008 21:52 ] [ ID #1941920 ]

Re: Retrieving Date & Time from a web server (localhost)

On Apr 14, 12:52=A0pm, teo <t... [at] inwind.it> wrote:
> I'm developing a software (a WinApp, not a WebApp)
> to retrieve Date & Time from a web server,
> but firstly I need to to test it on my PC, with "localhost"
>
> I'm using the VB Net language
> (below two different code approaches),
> I'm with XP Sp2 and IIS
> (all IIS http and ftp tasks regularly work)
>
> I have no firewall
> I think it maybe a matter of Service enabling
> (maybe involving the port 13...)
>
> Any attempt fail.
>
> 1 =A0approach)
> using the following VB Net API
>
> Private Declare Unicode Function NetRemoteTOD Lib "netapi32" ( _
> =A0 <MarshalAs(UnmanagedType.LPWStr)> ByVal ServerName As String, _
> =A0 ByRef BufferPtr As IntPtr) As Integer
>
> the entire example here:http://www.codeproject.com/KB/vb/NetRemoteTOD.aspx=
?fid=3D31067&df=3D90&mp...
>
> tried using
>
> "localhost" =A0
> "http//localhost" =A0
> "127.0.0.1"
>
> but always got =A000.00.00.00
>
> 2 approach)
> using this VB Net command
>
> Dns.GetHostByName("localhost")
>
> it seems to work because no error occurs
> (if I wrote "localhostSharonStone" an error occurs),
>
> but the very next command it does fail:
> objTcpClient.Connect("localhost", 13)
>
> it says (translated into English)
> "Impossible to establish a connection. The addressed computer
> keeps on refusing".
>
> Any hint?

sorry, but what exactly isnt working?
u running a webservice in your ide, and it fails?
jojoba [ Mo, 14 April 2008 22:02 ] [ ID #1941921 ]

Re: Retrieving Date & Time from a web server (localhost)

On Mon, 14 Apr 2008 13:02:22 -0700 (PDT), jojoba [at] gmail.com wrote:

>On Apr 14, 12:52 pm, teo <t... [at] inwind.it> wrote:
>> I'm developing a software (a WinApp, not a WebApp)
>> to retrieve Date & Time from a web server,
>> but firstly I need to to test it on my PC, with "localhost"
>>
>> I'm using the VB Net language
>> (below two different code approaches),
>> I'm with XP Sp2 and IIS
>> (all IIS http and ftp tasks regularly work)
>>
>> I have no firewall
>> I think it maybe a matter of Service enabling
>> (maybe involving the port 13...)
>>
>> Any attempt fail.
>>
>> 1  approach)
>> using the following VB Net API
>>
>> Private Declare Unicode Function NetRemoteTOD Lib "netapi32" ( _
>>   <MarshalAs(UnmanagedType.LPWStr)> ByVal ServerName As String, _
>>   ByRef BufferPtr As IntPtr) As Integer
>>
>> the entire example here:http://www.codeproject.com/KB/vb/NetRemoteTOD.aspx?fid= 31067&df=90&mp...
>>
>> tried using
>>
>> "localhost"  
>> "http//localhost"  
>> "127.0.0.1"
>>
>> but always got  00.00.00.00
>>
>> 2 approach)
>> using this VB Net command
>>
>> Dns.GetHostByName("localhost")
>>
>> it seems to work because no error occurs
>> (if I wrote "localhostSharonStone" an error occurs),
>>
>> but the very next command it does fail:
>> objTcpClient.Connect("localhost", 13)
>>
>> it says (translated into English)
>> "Impossible to establish a connection. The addressed computer
>> keeps on refusing".
>>
>> Any hint?
>
>sorry, but what exactly isnt working?
>u running a webservice in your ide, and it fails?

the code here, tested online with a real server,
it does work:
http://www.codeproject.com/KB/vb/NetRemoteTOD.aspx?fid=31067 &df=90&mp...

but if I locally tested it, writing "localhost",
like this
dRemoteDate = GetNetRemoteTOD("localhost")

always returns 00.00.00.00

note:
also tested it writing
"localhost"  
"http//localhost"  
"127.0.0.1"
TEO [ Mo, 14 April 2008 22:31 ] [ ID #1941922 ]

Re: Retrieving Date & Time from a web server (localhost)

On Apr 14, 1:31=A0pm, teo <t... [at] inwind.it> wrote:
> On Mon, 14 Apr 2008 13:02:22 -0700 (PDT), joj... [at] gmail.com wrote:
> >On Apr 14, 12:52=A0pm, teo <t... [at] inwind.it> wrote:
> >> I'm developing a software (a WinApp, not a WebApp)
> >> to retrieve Date & Time from a web server,
> >> but firstly I need to to test it on my PC, with "localhost"
>
> >> I'm using the VB Net language
> >> (below two different code approaches),
> >> I'm with XP Sp2 and IIS
> >> (all IIS http and ftp tasks regularly work)
>
> >> I have no firewall
> >> I think it maybe a matter of Service enabling
> >> (maybe involving the port 13...)
>
> >> Any attempt fail.
>
> >> 1 =A0approach)
> >> using the following VB Net API
>
> >> Private Declare Unicode Function NetRemoteTOD Lib "netapi32" ( _
> >> =A0 <MarshalAs(UnmanagedType.LPWStr)> ByVal ServerName As String, _
> >> =A0 ByRef BufferPtr As IntPtr) As Integer
>
> >> the entire example here:http://www.codeproject.com/KB/vb/NetRemoteTOD.a=
spx?fid=3D31067&df=3D90&mp...
>
> >> tried using
>
> >> "localhost" =A0
> >> "http//localhost" =A0
> >> "127.0.0.1"
>
> >> but always got =A000.00.00.00
>
> >> 2 approach)
> >> using this VB Net command
>
> >> Dns.GetHostByName("localhost")
>
> >> it seems to work because no error occurs
> >> (if I wrote "localhostSharonStone" an error occurs),
>
> >> but the very next command it does fail:
> >> objTcpClient.Connect("localhost", 13)
>
> >> it says (translated into English)
> >> "Impossible to establish a connection. The addressed computer
> >> keeps on refusing".
>
> >> Any hint?
>
> >sorry, but what exactly isnt working?
> >u running a webservice in your ide, and it fails?
>
> the code here, tested online with a real server,
> it does work:http://www.codeproject.com/KB/vb/NetRemoteTOD.aspx?fid= 3D3106=
7&df=3D90&mp...
>
> but if I locally tested it, writing "localhost",
> like this
> dRemoteDate =3D GetNetRemoteTOD("localhost")
>
> always returns =A000.00.00.00
>
> note:
> also tested it writing
> "localhost" =A0
> "http//localhost" =A0
> "127.0.0.1"- Hide quoted text -
>
> - Show quoted text -


maybe try your actual ip.....e.g. 192.168.1.xxx?
jojoba [ Mo, 14 April 2008 22:34 ] [ ID #1941923 ]

Re: Retrieving Date & Time from a web server (localhost)

On Apr 14, 1:34=A0pm, joj... [at] gmail.com wrote:
> On Apr 14, 1:31=A0pm, teo <t... [at] inwind.it> wrote:
>
>
>
>
>
> > On Mon, 14 Apr 2008 13:02:22 -0700 (PDT), joj... [at] gmail.com wrote:
> > >On Apr 14, 12:52=A0pm, teo <t... [at] inwind.it> wrote:
> > >> I'm developing a software (a WinApp, not a WebApp)
> > >> to retrieve Date & Time from a web server,
> > >> but firstly I need to to test it on my PC, with "localhost"
>
> > >> I'm using the VB Net language
> > >> (below two different code approaches),
> > >> I'm with XP Sp2 and IIS
> > >> (all IIS http and ftp tasks regularly work)
>
> > >> I have no firewall
> > >> I think it maybe a matter of Service enabling
> > >> (maybe involving the port 13...)
>
> > >> Any attempt fail.
>
> > >> 1 =A0approach)
> > >> using the following VB Net API
>
> > >> Private Declare Unicode Function NetRemoteTOD Lib "netapi32" ( _
> > >> =A0 <MarshalAs(UnmanagedType.LPWStr)> ByVal ServerName As String, _
> > >> =A0 ByRef BufferPtr As IntPtr) As Integer
>
> > >> the entire example here:http://www.codeproject.com/KB/vb/NetRemoteTOD=
..aspx?fid=3D31067&df=3D90&mp...
>
> > >> tried using
>
> > >> "localhost" =A0
> > >> "http//localhost" =A0
> > >> "127.0.0.1"
>
> > >> but always got =A000.00.00.00
>
> > >> 2 approach)
> > >> using this VB Net command
>
> > >> Dns.GetHostByName("localhost")
>
> > >> it seems to work because no error occurs
> > >> (if I wrote "localhostSharonStone" an error occurs),
>
> > >> but the very next command it does fail:
> > >> objTcpClient.Connect("localhost", 13)
>
> > >> it says (translated into English)
> > >> "Impossible to establish a connection. The addressed computer
> > >> keeps on refusing".
>
> > >> Any hint?
>
> > >sorry, but what exactly isnt working?
> > >u running a webservice in your ide, and it fails?
>
> > the code here, tested online with a real server,
> > it does work:http://www.codeproject.com/KB/vb/NetRemoteTOD.aspx?fid= 3D31=
067&df=3D90&mp...
>
> > but if I locally tested it, writing "localhost",
> > like this
> > dRemoteDate =3D GetNetRemoteTOD("localhost")
>
> > always returns =A000.00.00.00
>
> > note:
> > also tested it writing
> > "localhost" =A0
> > "http//localhost" =A0
> > "127.0.0.1"- Hide quoted text -
>
> > - Show quoted text -
>
> maybe try your actual ip.....e.g. 192.168.1.xxx?- Hide quoted text -
>
> - Show quoted text -

or try empty string "" also

one more thing....make sure you have a colon in your "http://
localhost"
jojoba [ Mo, 14 April 2008 22:35 ] [ ID #1941924 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Retrieving Date & Time from a web server (localhost)

Vorheriges Thema: how can the website work fine in VS but not in deploy???
Nächstes Thema: Session["UserName"]