Solved

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

Posted on 2004-08-23
1
2,957 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:Pedro 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

632 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