Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Retrieving Date & Time from a web server (localhost)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
teo - 14 Apr 2008 20:52 GMT
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?
jojoba@gmail.com - 14 Apr 2008 21:02 GMT
> I'm developing a software (a WinApp, not a WebApp)
> to retrieve Date & Time from a web server,
[quoted text clipped - 44 lines]
>
> Any hint?

sorry, but what exactly isnt working?
u running a webservice in your ide, and it fails?
teo - 14 Apr 2008 21:31 GMT
>> I'm developing a software (a WinApp, not a WebApp)
>> to retrieve Date & Time from a web server,
[quoted text clipped - 47 lines]
>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"
jojoba@gmail.com - 14 Apr 2008 21:34 GMT
> >> I'm developing a software (a WinApp, not a WebApp)
> >> to retrieve Date & Time from a web server,
[quoted text clipped - 64 lines]
>
> - Show quoted text -

maybe try your actual ip.....e.g. 192.168.1.xxx?
jojoba@gmail.com - 14 Apr 2008 21:35 GMT
On Apr 14, 1:34 pm, joj...@gmail.com wrote:

> > >> I'm developing a software (a WinApp, not a WebApp)
> > >> to retrieve Date & Time from a web server,
[quoted text clipped - 68 lines]
>
> - Show quoted text -

or try empty string "" also

one more thing....make sure you have a colon in your "http://
localhost"
teo - 14 Apr 2008 23:09 GMT
>or try empty string "" also
>
>one more thing....make sure you have a colon in your "http://
>localhost"

ouch !!
the empty string "" worked for the first approach (odd to me)

the second approach still doesn't work (maybe because a port number is
involved) but it is enough for now

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.