473,382 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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(UnmanagedType.LPWStr)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.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?

Jun 27 '08 #1
3 2567
On Apr 14, 12:52*pm, teo <t...@inwind.itwrote:
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/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.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?
Jun 27 '08 #2
teo
On Mon, 14 Apr 2008 13:02:22 -0700 (PDT), jo****@gmail.com wrote:
>On Apr 14, 12:52*pm, teo <t...@inwind.itwrote:
>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/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.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/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.com 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
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. ...
1
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...
4
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...
4
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...
3
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...
2
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...
3
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...
1
by: aRTx | last post by:
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Artani <artan_p@msn.com>. www.artxcenter.com REQUIREMENTS ============ This script requires...
3
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.