View unanswered posts | View active topics

Reply to topic  [ 3 posts ] 

Joined: Wed Jun 08, 2011 8:59 am
Posts: 4
Post Server status
vk> Dear Sir,
vk> First of all thank you very much for your great support ,now I have still
vk> some question related to Awasu server ,Is there any API available to get
vk> status of Awasu server for running or not?
vk> 1] How will we get the responce for any api like
vk> \\localhost:xxxx\channels\get <file://localhost:xxxx/channels/get> after
vk> sending http request please provide any example.


Wed Jun 29, 2011 5:14 am
Profile
Site Admin
User avatar

Joined: Fri Feb 07, 2003 8:48 am
Posts: 2883
Location: Melbourne, Australia
Post Re: Server status
virla wrote:
Is there any API available to get
vk> status of Awasu server for running or not?

No. If the server is not running, how are you going to get a response? :-) Probably the best way to check if the server is up is to send a request and see if you get a reply e.g. $/buildInfo is nice and inoffensive. Or even just try to connect to the port - if no-one is listening, the server is dead.

virla wrote:
vk> 1] How will we get the responce for any api like
vk> \\localhost:xxxx\channels\get <file://localhost:xxxx/channels/get> after
vk> sending http request please provide any example.

The Awasu API runs over HTTP so it's just a question of reading the HTTP response. kevotheclone already gave you some useful information here.


Wed Jun 29, 2011 5:38 am
Profile WWW
User avatar

Joined: Mon Sep 08, 2008 3:16 pm
Posts: 222
Location: Elk Grove, California
Post Re: Server status
I agree that sending a request and to $/buildInfo is the best way to determine if the Awasu API is available.

FWIW there are ways to tell if Awasu is running on a specific PC/Server. The example below uses Windows Management Instrumentation (WMI) to determine if an execuatble named "awasu.exe" is running and if it is, return the full path from which it was run. This example is written in VBScript, but you could recode it in a variety of langauges. The "." for the "strComputer" variable's value means to run against the localhost computer, but you can substitute a different computer name and it should run as long as you have administrative rights on that computer.

Code:
Option Explicit

Dim strComputer ' As String
Dim strExeName ' As String

strComputer = "."
strExeName = "awasu.exe"

MsgBox GetProcessPath(strComputer, strExeName)

Function GetProcessPath(strComputer, strProcess)
  Dim objWMIService ' As SWbemServicesEx
  Dim colProcesses  ' As SWbemObjectSet
  Dim objProcess    ' As SWbemObjectEx
  Dim User          ' As String
  Dim Domain        ' As String
  Dim lngRetVal     ' As Long

  Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" &  strProcess & "'")

  For Each objProcess In colProcesses
    lngRetVal = objProcess.GetOwner(User, Domain)
    If lngRetVal = 0 Then
' Uncomment the next lines to display some details of the process during debugging.
'      Wscript.Echo "Process " & objProcess.Caption & _
'                   " belongs to " & Domain & _
'                   "\" & User & _
'                   " on " & objProcess.CSName & _
'                   " using " & objProcess.ExecutablePath & _
'                   " with the command line " & objProcess.CommandLine

      GetProcessPath = objProcess.ExecutablePath
      Exit Function
    Else

' Uncomment the next line if you need to debug this.
'      Wscript.Echo "Problem #" & lngRetVal & " getting the owner for process " & objProcess.Caption

      GetProcessPath = vbNullString
      Exit Function
    End If ' objProcess.GetOwner(User, Domain) = 0
  Next ' objProcess
End Function ' GetProcessPath(strComputer, strProcess)


This will not tell you if the Awasu API has been enabled or not, that's where the call to $/buildInfo comes into play.


Mon Jan 16, 2012 3:44 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online
Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron