vb.net connection refused?

The place where software developers meet

Moderator: marcus

vb.net connection refused?

Postby codefinger » Mon 2. Aug 2010, 03:27

Why does the code below return an error message of:

"Cannot connect to IRTrans Server: No connection could be made because the target machine actively refused it 127.0.0.1:21000"


Code: Select all
Public WithEvents irt As IRTrans.NET.IRTransServer

    Public Function Initialize(ByRef lex As LastException) As Boolean
        Dim retval As Boolean = True

        Try
            irt = New IRTrans.NET.IRTransServer("localhost")
       Catch ex As Exception
            retval = False
            lex.ErrorMessage = ex.Message
            If Not ex.InnerException Is Nothing Then
                lex.ErrorMessage = lex.ErrorMessage & ex.InnerException.Message
            End If

        End Try

        Return retval

    End Function
codefinger
 
Posts: 4
Joined: Mon 19. Jul 2010, 01:27

Re: vb.net connection refused?

Postby IRTrans » Mon 2. Aug 2010, 11:13

Very simple: The irserver is not running. It could also be a firewall blocking access to the irserver.

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Re: vb.net connection refused?

Postby codefinger » Mon 2. Aug 2010, 14:48

Ok, so if I start IRServer from outside my program, the code works and I can create a new instance of the
IRTrans.Net.IRServer with which to work.

However, when I try to start irserver from within my program using

prc = System.Diagnostics.Process.Start("C:\Program Files\IRTrans\irtranstray.exe", "USB")
the server pops up a message that it could not open the remote database (no folder 'remotes' /Access rights?)
After that I am unable to start the irtrans server again from outside the program without restarting the computer because it reports "No IRTrans devices found."

(Sorry if these questions seem obvious, but I am unable to open the .net example with my copy of VB 2010 Express,
so I am feeling my way through a little at a time.)

Any ideas, assistance, suggestions appreciated. Thanks in advance.
codefinger
 
Posts: 4
Joined: Mon 19. Jul 2010, 01:27

Re: vb.net connection refused?

Postby IRTrans » Mon 2. Aug 2010, 15:35

The server should normally be started before your program is started.

If you start it yourself you need to make sure you are in the correct folder (cd to where the server binary is installed).
Otherwise it will not find the remote database.

Please note that this is not covered by our code examples as we would strongly suggest to start the server together with the OS.

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Re: vb.net connection refused?

Postby codefinger » Mon 2. Aug 2010, 17:11

Ok, got it. I can do that, just check for the server running or not and warn the user to start it if it is not running..

Another question, though, about

IRTrans.NET.NETWORKSTATUS

Most of the functions I have tried so far return this value as nothing.
Is that normal if everything worked as it should?

Thanks for answering my questions so quickly. I appreciate your time and your patience.
codefinger
 
Posts: 4
Joined: Mon 19. Jul 2010, 01:27

Re: vb.net connection refused?

Postby IRTrans » Mon 2. Aug 2010, 17:47

Correct, in case everything is OK you will get "nothing".

Any error will be reported in a NETWORKSTATUS.

Functions returning something meaningful (e.g. a list of remote controls) will either return that result or a NETWORKSTATUS.

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32


Return to APIs

Who is online

Users browsing this forum: No registered users and 14 guests