Results 1 to 17 of 17

Thread: i need something that can return the status of my servers

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Resolved i need something that can return the status of my servers

    A friend of mine needs something that can return the status of his servers. He's given me the ports to check

    Checking POP3 server......code is checking domain.com on port 110
    Check HTTP server........ code is checking dsartain.com on port 80

    I need to know if VB6 or VB.NET can do this for me, and if so, how the heck do I tell it to check the ports?? I could probably ping it, but I don't know how to tell VB to do that. Any assistance would be much appreciated. He's helped me so much with PHP I'd love to be able to get this done for him. Thanks
    Last edited by dsartain; Mar 15th, 2006 at 11:46 PM. Reason: RESOLVED:::::::::::::

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    This easy, all you have to do is have a socket connect to the server...

    if it connects - server is alive
    is not - server is down

    let me just do the code
    Chris

  3. #3
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    alright heres the code, i uploaded the project files too, this project uses the Winsock control, which is used to connect to servers/hosts to send data. In this example it doesnt send any data, it simply trys to connect.

    its very simple code, if you want to learn more about Winsock the best site is

    http://www.winsockvb.com

    PS: this is VB6 and dont forget to change the servers domain names in the code, you will notice they are pop.google.com and google.com
    Attached Files Attached Files
    Chris

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Question Re: i need something that can return the status of my servers

    Awesome! Next issue I have is with proxy settings. I can place a couple of text fields on the form to let the user fill out the settings, but how do I assign the values to what the program will need to connect through the proxy server?

  5. #5
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    so you want your program to connect to the pop or http server through a proxy? which type of proxy?
    Chris

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Question Re: i need something that can return the status of my servers

    Well, I run through an HTTP proxy at my school...it would be awesome if I could just inherit connection settings from IE or something like that, but that's way over my head. I think that if I allow SOCKS 4 and 5, and HTTP(S) that I'll be good. Also, sckFTP.connect and sckSMTP.connect aren't recognized in VB6...is that the wrong code to connect to FTP and SMTP??

  7. #7
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    are we still talking about the server checker here? you want your server checker to be able to go through HTTP/SOCKS4/5 proxies?

    sckPOP and sckHTTP are the names of the socket in my app, it could be anything, to specifiy the protocl, you set the port in the connect like, like this

    VB Code:
    1. sckSTMP.Connect "smtp.google.com", [B]25[/B]
    the 25 is the port number, this is the SMTP port, the socket name could be anything, whatever you want to call it
    Chris

  8. #8
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    you can get the IE settings quite easily from the registry
    Chris

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Question Re: i need something that can return the status of my servers

    Yeah, I need the server checker to be able to run through proxies. I figured out about the winsock icon in the tool bar...thanks though.

  10. #10
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    if your school goes through a proxy to get websites etc wont it automatically go through the proxy when you try to connect to domain.com or pop.domain.com, try the app at your school and see what happens
    Chris

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Re: i need something that can return the status of my servers

    Yeah, I built it at my school....didn't work through proxy server, went around the server to check if program worked...I'll have to inherit the internet connection settings from the registry

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Question Re: i need something that can return the status of my servers

    Ok, I've figured out what the hell is going on! the IF statements are processing fine, used label captions to determine that.

    Problem is that there can only be 1 winsock control connection per application at a time..i.e. can't have an HTTP page and an FTP page open at the same time in the same browser window...

    So I need to know how to process the first winsock connection...put the rest on hold, and then step to the next one...array won't work though because if 0 and 2 index values are checked then it still processes 0 and 1 winsock controls...does that make sense??? I know I can't use a sleep command either....any other ideas????

  13. #13
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    can you show the code up to now
    Chris

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Re: i need something that can return the status of my servers

    CODE:

    Private Sub Form_Load()
    For x = 0 To 3 Step 1
    checkBox(x).Value = vbUnchecked
    Next x
    count_no_checks = 0
    End Sub
    Private Sub cmdCheck_Click()
    If checkBox(0).Value = vbChecked Then
    sckHTTP.Connect "dsartain.com", 80
    lblBox(0).Caption = "checked"
    Else
    lblBox(0).Caption = "unchecked"
    End If

    If checkBox(1).Value = vbChecked Then
    sckFTP.Connect "ftp.dsartain.com", 21
    lblBox(1).Caption = "checked"

    Else
    lblBox(1).Caption = "unchecked"
    End If

    If checkBox(2).Value = vbChecked Then
    sckPOP.Connect "mail.dsartain.com", 110
    lblBox(2).Caption = "checked"
    Else
    lblBox(2).Caption = "unchecked"
    End If

    If checkBox(3).Value = vbChecked Then
    sckSMTP.Connect "mail.dsartain.com", 25
    lblBox(3).Caption = "checked"
    Else
    lblBox(3).Caption = "unchecked"
    End If
    End Sub

    Private Sub sckHTTP_Close()
    sckHTTP.Close
    End Sub

    Private Sub sckHTTP_Connect()
    sckHTTP.Close
    MsgBox "The HTTP control connected successfully"
    End Sub

    Private Sub sckHTTP_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    sckHTTP.Close
    MsgBox "The HTTP Server Is Down!"
    End Sub

    Private Sub sckFTP_Close()
    sckFTP.Close
    End Sub

    Private Sub sckFTP_Connect()
    sckFTP.Close
    MsgBox "The FTP control connected successfully"
    End Sub

    Private Sub sckFTP_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    sckFTP.Close
    MsgBox "The FTP Server Is Down!"
    End Sub

    Private Sub sckPOP_Close()
    sckPOP.Close
    End Sub

    Private Sub sckPOP_Connect()
    sckPOP.Close
    MsgBox "The POP control connected successfully"
    End Sub

    Private Sub sckPOP_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    sckPOP.Close
    MsgBox "The POP Server Is Down!"
    End Sub

    Private Sub sckSMTP_Close()
    sckSMTP.Close
    End Sub

    Private Sub sckSMTP_Connect()
    sckSMTP.Close
    MsgBox "The SMTP control connected successfully"
    End Sub

    Private Sub sckSMTP_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    sckHSMTP.Close
    MsgBox "The SMTP Server Is Down!"
    End Sub

  15. #15
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    have you got the proxy settings, you need the IP and port, what type of proxy is it HTTP?
    Chris

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    18

    Question Re: i need something that can return the status of my servers

    Ok, so far everything is working without the proxy server (cause I bypassed it). Friend says he could give a damn less about proxies because no one uses them, so I'm not so worried about that anymore, unless it's just easy to do, then I'd love it.

    Now he wants me to check and see if the domain entered is acutally registered to his DNS...ie. IF www.data-extreme.com is registered to DNS1.......Then......else...MSGBox.....Do you know how to check for that, or at least to connect to a specific DNS server??

  17. #17
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: i need something that can return the status of my servers

    you can connect to a WHOIS server and query it with "data-extreme.com" the WHOIS server will give you the list of name servers, is this what you want? it would give you this:

    NS1.DATA-EXTREME.COM
    NS2.DATA-EXTREME.COM

    or if he has a static IP which he should, you can do a reverse DNS on the domain name, which will tell you the IP of the domain name, and if the IP matches his static IP then its registered to his DNS, if it doesnt match its not - i thnk this would work
    Chris

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width