|
using System;
namespace Remote
{
[Serializable]
public struct kAction
{
public string s_Command; // the text to be sent by master
public string s_Computer; // Computer name of the sender (=slave)
// to transfer more data expand here...
};
[Serializable]
public struct kResponse
{
public string s_Result; // the response text sent by slave
// to transfer more data expand here...
};
public class cTransfer : MarshalByRefObject
{
public delegate kResponse del_SlaveCall(kAction k_Action);
public event del_SlaveCall ev_SlaveCall;
// Default public no argument constructor
public cTransfer()
{
}
public kResponse CallSlave(kAction k_Action)
{
return ev_SlaveCall(k_Action);
}
/// <summary>
/// This override is EXTREMELY important
/// If it is missing the garbage collector of the Slave will delete the cTransfer object
/// after 5 minutes and the event will be lost, so further calls to the slave will return
/// "Server encountered an internal error" (a very helpful Mircrosoft error message!)
/// This function sets the livetime to infinite
/// See http://www.thinktecture.com/Resources/RemotingFAQ/SINGLETON_IS_DYING.html
/// </summary>
public override Object InitializeLifetimeService()
{
return null;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.