473,624 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieving Date & Time from a web server (localhost)

teo
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(Unma nagedType.LPWSt r)ByVal ServerName As String, _
ByRef BufferPtr As IntPtr) As Integer

the entire example here:
http://www.codeproject.com/KB/vb/Net...715#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.GetHostByNa me("localhost" )

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

but the very next command it does fail:
objTcpClient.Co nnect("localhos t", 13)

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


Any hint?

Jun 27 '08 #1
3 2577
On Apr 14, 12:52*pm, teo <t...@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(Unma nagedType.LPWSt r)ByVal ServerName As String, _
* ByRef BufferPtr As IntPtr) As Integer

the entire example here:http://www.codeproject.com/KB/vb/Net...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.GetHostByNa me("localhost" )

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

but the very next command it does fail:
objTcpClient.Co nnect("localhos t", 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?
Jun 27 '08 #2
teo
On Mon, 14 Apr 2008 13:02:22 -0700 (PDT), jo****@gmail.co m wrote:
>On Apr 14, 12:52*pm, teo <t...@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(Unma nagedType.LPWSt r)ByVal ServerName As String, _
* ByRef BufferPtr As IntPtr) As Integer

the entire example here:http://www.codeproject.com/KB/vb/Net...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.GetHostByN ame("localhost" )

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

but the very next command it does fail:
objTcpClient.C onnect("localho st", 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/Net...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"

Jun 27 '08 #3
teo
On Mon, 14 Apr 2008 13:35:37 -0700 (PDT), jo****@gmail.co m wrote:
>
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

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2147
by: Ken | last post by:
First time I have installed mysql. I have not been able to connect to the server/database with a new php installation. I have installed IIS. Do I need this for mysql? The php works fine. I can run scripts,etc. When I try mysql_connect ("localhost","mysql_user", mysql_password") or
1
2027
by: Marc | last post by:
I've got a PHP script that's using fopen to connect to a remote web server and pick up data. I've run into a problem in calculating elapsed time. The remote web server outputs a time and I'd like to calculate the difference between that time and the current time. The problem is that the time on the remote server isn't in sync with the time on my server (off by about 5 minutes) and this throws off the elapsed time calculations. I know...
4
2274
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time 6 hours wrong. The time should be GMT minus 6 hours. Can anyone help me with that? Her's the code: <?php header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
4
2796
by: MLH | last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application for me. When he was done, he sent me the PHP files and the MySQL dump file. Now, when I connect to the application on my LAN using http://192.168.1.106/~mlh/credifree/index.php the AMP app still thinks the data resides somewhere else. It runs fine - as long as I leave my LAN's external internet connection up. But if I unplug my LAN from the world, my app locks up. Before I...
3
2530
by: Dotnet Gruven | last post by:
I've built a WebForm with a Table added dynamically in Page_Load when IsPostBack is false. The table includes a couple of TextBoxes, RadioButtonLists and CheckboxLists. On postback, those controls are not present nor their valves in Request.Form.AllKeys.
2
1298
by: Bill Nguyen | last post by:
I receive data in an XML file with the following date/time format. While I can parse the date & time using string function, I would like to know if this is some sort of datetime in SQLserver that I can use directly: <DateTime>2006-03-29T13:12:00.000</DateTime> Thanks Bill
3
3087
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn =server.createobject("ADODB.connection") objConn.open "DSN=Photo" Dim sqlSELsite,ObjRSSel sqlSELsite = "SELECT Name FROM tblbwday WHERE B'day ="& date() &" " '
1
4135
by: aRTx | last post by:
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Artani <artan_p@msn.com>. www.artxcenter.com REQUIREMENTS ============ This script requires PHP and GD2 if you wish to use the
3
5176
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8173
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2606
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.