Android Question Anyone having any luck running RDC as a windows service reliably?

Steve Miller

Active Member
Licensed User
Longtime User
I've spent the whole day trying to get RDC to run as a windows service. I've been able to get it to install as a windows service using Yet Another Java Service Wrapper (YAJSW), but just can't get my app to connect.

If anyone has been able to get it working as a windows service with complete reliability, can you please post what you used and the settings used to get this up and running?

Thanks.
 

Steve Miller

Active Member
Licensed User
Longtime User
I've done some further testing, but can't figure out why my app is not able to communicate with RDC as a service. Here's is what I have done to test.

I started RDC as a windows service and it starts fine.
I browse to http://127.0.0.1:17178/?method=test and I get the Connection successful message.
But for some reason, my app will not connect when it runs this way. If I start it using the batch file and Java, it works fine.

Here is some code I have in my app for testing the connection to see if it is active or not. There is a lot more in there, but this is just the code related to checking if RDC is available.

B4X:
Sub Process_Globals
    Dim reqManager As DBRequestManager
    Dim RDCAvailable As Boolean
    Dim httprdc As HttpClient

End Sub

Sub Globals
    Dim RDCIP As String
End Sub

Sub Activity_Create(FirstTime As Boolean)
       
        If FirstTime Then
            RDCAvailable=False
            RDCIP="http://192.168.1.151:17178"
            reqManager.Initialize(Me, RDCIP)           
        End If
       
        IsRDCRunning
       
End Sub
Sub IsRDCRunning

    Dim rdctest As String
    Dim req As HttpRequest
   
    rdctest=RDCIP & "/?method=test"
    req.InitializeGet(rdctest)
    httprdc.Initialize("CheckRDC")   
    httprdc.Execute(req,1)
   
End Sub
Sub CheckRDC_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)

    RDCAvailable=False
    btnUpload.Enabled=False

    Log("error: RDC Server is not responding. Is it running?")
    If Response <> Null Then
        Log(Response.GetString("UTF8"))
        Response.Release
    End If
End Sub
Sub CheckRDC_ResponseSuccess (Response As HttpResponse, TaskId As Int)
    RDCAvailable=True
    Log("RDC Server is responding.")
End Sub
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Have you opened the 17178 port in the router ? the address 127.0.0.1 is from inside your pc, the 192.168.1.151 is from the lan. If your router does not pass the port it will not reach your pc, even if you browse in it.
 
Upvote 0

Steve Miller

Active Member
Licensed User
Longtime User
It's all done on the same computer. Works with the browser, but not with the program. Strange thing is it will work with the program if I run the following in a batch file:

"C:\Program Files (x86)\Java\jre7\bin\java" -Xmx256m -cp .;libs\*;jdbc_driver\* anywheresoftware.b4a.remotedatabase.RemoteServer
pause
 
Upvote 0

Steve Miller

Active Member
Licensed User
Longtime User
Have you opened the 17178 port in the router ? the address 127.0.0.1 is from inside your pc, the 192.168.1.151 is from the lan. If your router does not pass the port it will not reach your pc, even if you browse in it.

Both 127.0.0.1 and 192.168.1.151 are the same computer, in this instance. And, it works with both addresses in the browser, just not in the app, unless I just run the RDC thru the batch file, as mentioned in the above post.
 
Upvote 0

Steve Miller

Active Member
Licensed User
Longtime User
Excellent, that did the trick. Now, if it stops running for whatever reason, I need to stop it and restart it. With a service, that would be easy, I could monitor the service and issue stops and restarts from a program I have for just that reason. How would I be able to monitor it, running this way?
 
Upvote 0

Steve Miller

Active Member
Licensed User
Longtime User
I can't go by that. I have other Java apps running and can't determine which is which.
I need to get this running as a service. I just don't understand why I can see it fine with the browser, but the app can't see it. Makes no sense.
 
Upvote 0
Top