Solved

How to ping/connect to port (SMTP) and receive answer

Posted on 2004-08-23
1
2,955 Views
Last Modified: 2008-01-09
Hi there,

Now standing in front of quite nice piece of work. I am supposed to write a small ASP code (which will be running on intranet IIS system), which will allow users to preview an application server status. I might use components as well, but just do not know, where to start.

I need to have some code snippets which will:
* allow me to run a ping from web server and show results (available/NOT available)
* allow me to connect to a specified server port, send there something and receive a response
   (to check the service availability)
* etc.

Is this possible? Any ideas? web links are OK, you do not need to write a lot, just say... man, you are crazy, it is not possible.... or say yep, just use this and this...


Thanks a lot.

Bye
Petr

0
Comment
Question by:keson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
rhrowson earned 125 total points
ID: 11873142
I have a vbscript that does this in conjunction with a text file. It polls for the presence of a particular page. You could modify the page it calls to send an e-mail:

Script:

Dim varTestURL
Dim varSiteName
Dim varTestURLLength
Dim varSiteNameLength
Dim varFS
Dim varInputFile
Dim varOutputFile



Set varFS=CreateObject("Scripting.FileSystemObject")
Set varInputFile = varFS.OpenTextFile("C:\WebServers.txt",1,True)




Do While Not varInputFile.AtEndOfStream
   



varTestURL=varInputFile.ReadLine



'varTestURL="http://phone/server_info.asp"
varTestURLLength=Len(varTestURL)
varSiteNameLength=InStr(8,varTestURL,"/",1)
varSiteName=Mid(varTestURL,8,(varSiteNameLength-8))
'MsgBox varSiteName
Set xmlHTTP = CreateObject("Microsoft.XMLHTTP")

xmlHTTP.Open "GET", varTestURL, False

xmlHTTP.Send
'WScript.Echo "Server Response: " & xmlHTTP.Status
If xmlHTTP.Status=200 Then
'MsgBox "OK", vbOK

'WScript.Echo
'WScript.Echo "Headers"
'WScript.Echo "======="
'WScript.Echo xmlHTTP.GetAllresponseHeaders
'WScript.Echo
'WScript.Echo "HTML"
'WScript.Echo "======="
'WScript.Echo xmlHTTP.responseText
Elseif xmlHTTP.Status<>200 Then
'       MsgBox"Panic",vbcritical
       
       
        MsgBox varSiteName & " is down"
        Set varOutputFile=varFS.OpenTextFile("C:\WebServers1.txt",8,True)
        varOutputFile.writeline(varSiteName & " Is down " & Date & " "& Time)
        varOutputFile.Close
End If

Set xmlHTTP = Nothing

Loop

You will need to create the text file and each line should look like this:

http://test/server_info.asp

the page could be an SMTP test page
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Allow X-Forwarded-For Headers to Site or No? 3 88
Output Caching in IIS 2 45
Publishing SSRS Reports to an IIS Server 3 112
OWA issue - Exchange 2013 - 440 Login Timeout 8 61
Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question