virla
Posts: 4
Joined: Wed Jun 08, 2011 12:59 pm

Postby virla » Wed Jun 29, 2011 9:14 am

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.

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Wed Jun 29, 2011 9:38 am

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.

User avatar
kevotheclone
Posts: 239
Joined: Mon Sep 08, 2008 7:16 pm
Location: Elk Grove, California

Postby kevotheclone » Mon Jan 16, 2012 7:44 pm

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: Select all

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.


Return to “Awasu - Extensions”

Who is online

Users browsing this forum: No registered users and 1 guest