More info about the inner workings of the .Net DLL

The place where software developers meet

Moderator: marcus

More info about the inner workings of the .Net DLL

Postby miljbee » Thu 7. Feb 2013, 16:00

Hello,

I am about to write a module for my own Home automation software to handle my irTrans (LAN rcv/tr).

I have looked at your .Net example, And I would like some more info about the dll :

Code: Select all
irt = new IRTransServer ("localhost");

Does this actually connect to the irTrans Module ?

Code: Select all
NETWORKSTATUS stat = irt.IRSend ("sony","play");

Does this function returns once the ir has been sent, or just when the module has received the packets ? (I Need to know this to avoid flooding)
Could we have more info on the NETWORKSTATUS Class properties ?
Once the function returns, is the connection closed or left opened ?
if it's left opened, is it forever ?
if it's left opened and after some time I unplug the Module from the network, will I ever receive the ConnectionLost event before actually sending something ?
When sending something, if the module is unreachable for some reason, will I receive an exception, or just "something" in NETWORKSTATUS object ?
If I then reconnect the module, will the irSend just work (automatically reconnects), or will I have to create a new IRTransServerObject ?

Same questions for the AsyncReceiver, what happens if the module become unreachable.

My need is only to blast and receive. Wouldn't it be easier to use a simple udpClient ?

Thank you for your help.
miljbee
 
Posts: 8
Joined: Mon 22. Nov 2010, 21:46

Re: More info about the inner workings of the .Net DLL

Postby IRTrans » Thu 7. Feb 2013, 19:35

Hi,
regarding your questions:

The exact is different depending on the way you connect. If you connect to a running IRTrans server (e.g. "localhost") you have a TCP connection with the IRTrans server SW. The server talks to the IRTrans device via UDP. That means "irt = new IRTransServer ("localhost");" connects to the irserver which, of course needs to know about the IRTrans device.

"NETWORKSTATUS stat = irt.IRSend ("sony","play");":
This call returns once the packet has been sent. When you send the next IR Code the irserver will wait until it can be sent. That means you can never flood the device as long as you wait until the call returns.

When there is an error the NETWORKSTATUS will contain an error code and an error description.

The connection is always left open until you close it with "irt.close();".

Now things start to get different when you connect directly to the device.

With an irserver connection:
When the device is disconnected you will get an error message (in the NETWORKSTATUS) when you try to send an IR Code. As soon as the device is reconnected sending works again. There is no need to reopen the connection.
When the irserver is closed you will get an Exception on the next send and you will need to reconnect.

With a direct connection:
You will get an Exception when you try to send after disconnecting the module. After it is "back" you will need to reopen the connection.

Of course you can also use an UDP connection - however, using the .NET DLL would be easier.

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 11 guests