I would like to check and manage the serverstate (start the server if it not running) from outside (VB-program). Checking if java.exe is running does not make so much sense.
h725
EDIT:
3 minutes after posting this entry I got an idea which might suit for me.
I have a snippet :
B4X:
Private Function IsPortOpen(ByVal Host As String, ByVal PortNumber As Integer) As Boolean
Dim Client As TcpClient = Nothing
Try
Client = New TcpClient(Host, PortNumber)
Return True
Catch ex As SocketException
Return False
Finally
If Not Client Is Nothing Then
Client.Close()
End If
End Try
End Function
Which checks if the port opens. I started and stopped the jRDC2 server and it obviously gives the correct response back. Are there any objections in using this ?