本文整理汇总了C#中System.Runtime.Remoting.ObjRef类的典型用法代码示例。如果您正苦于以下问题:C# ObjRef类的具体用法?C# ObjRef怎么用?C# ObjRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjRef类属于System.Runtime.Remoting命名空间,在下文中一共展示了ObjRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoteServer
/// <summary>
/// Initializes a new instance of the <see cref="RemoteServer"/> class.
/// </summary>
public RemoteServer()
{
RemoteObj = new RemoteObject();
serverchannel = new IpcChannel("localhost:15000");
ChannelServices.RegisterChannel(serverchannel, false);
ref1 = RemotingServices.Marshal(RemoteObj, "RemoteObject.rem");
Console.WriteLine("ObjRef1 URI: " + ref1.URI);
RemoteObj.ObjectSent += new ObjectSentEventHandler(OnObjectSent);
}
示例2: UnmarshaledObject
public void UnmarshaledObject(
object obj,
ObjRef or
)
{
Console.WriteLine(AppDomain.CurrentDomain.FriendlyName+" Unmarshaled: "+obj.GetType().FullName);
}
示例3: RemotingHostServer
public RemotingHostServer(Machine machine, int port, string name)
: base(machine)
{
this.port = port;
this.name = name;
// TODO review this name, get machine name
this.hostname = "localhost";
// According to http://www.thinktecture.com/resourcearchive/net-remoting-faq/changes2003
// in order to have ObjRef accessible from client code
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = port;
TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
if (!registered)
{
ChannelServices.RegisterChannel(channel, false);
registered = true;
}
// end of "according"
// TODO review other options to publish an object
this.objref = RemotingServices.Marshal(this, name);
}
示例4: InitialisiereRemotableObject
// stellt dieses Objekt via Remoting zur Verfügung
public void InitialisiereRemotableObject()
{
// melde dieses Objekt unter der gegebenen URL auf dem spezifierten Pfad an
_PortalLogikObjRef = RemotingServices.Marshal(
this,
this._Pfad,
((Object)this).GetType());
}
示例5: UnmarshaledObject
// Notifies a handler that an object has been unmarshaled.
public void UnmarshaledObject(Object obj, ObjRef or)
{
if (obj.GetType() != typeof(AppDomain))
Trace.WriteLine(string.Format("Tangra Addins: Unmarshaled instance of {0} ({1} HashCode:{2})", or.TypeInfo != null ? or.TypeInfo.TypeName : obj.GetType().ToString(), or.URI != null ? or.URI.ToString() : "N/A", obj.GetHashCode().ToString()));
else
{
// Not interested in AppDomain marshalling
}
}
示例6: ObjRef
internal ObjRef (ObjRef o, bool unmarshalAsProxy) {
channel_info = o.channel_info;
uri = o.uri;
typeInfo = o.typeInfo;
envoyInfo = o.envoyInfo;
flags = o.flags;
if (unmarshalAsProxy) flags |= MarshalledObjectRef;
}
示例7: DeserializeInTheCurrentDomain
internal ObjRef DeserializeInTheCurrentDomain (int domainId, byte[] tInfo)
{
string local_uri = string.Copy (this.uri);
ChannelInfo cinfo = new ChannelInfo (new CrossAppDomainData (domainId));
ObjRef res = new ObjRef (local_uri, cinfo);
IRemotingTypeInfo typeInfo = (IRemotingTypeInfo)CADSerializer.DeserializeObjectSafe (tInfo);
res.typeInfo = typeInfo;
return res;
}
示例8: ObjRef
private ObjRef(ObjRef o)
{
this.uri = o.uri;
this.typeInfo = o.typeInfo;
this.envoyInfo = o.envoyInfo;
this.channelInfo = o.channelInfo;
this.objrefFlags = o.objrefFlags;
this.SetServerIdentity(o.GetServerIdentity());
this.SetDomainID(o.GetDomainID());
}
示例9: MarshaledObject
// Notifies a handler that an object has been marshaled.
public void MarshaledObject(Object obj, ObjRef or)
{
if (obj.GetType() != typeof(AppDomain))
{
if (TraceSwitchAppDomainTracking.Enabled)
Trace.WriteLine(string.Format("OccuRec: Marshaled instance of {0} ({1} HashCode:{2})", or.TypeInfo != null ? or.TypeInfo.TypeName : obj.GetType().ToString(), or.URI != null ? or.URI.ToString() : "N/A", obj.GetHashCode().ToString()));
}
else
{
// Not interested in AppDomain marshalling
}
}
示例10: SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
IMethodMessage methodMessage = (IMethodMessage)msg;
if (methodMessage.MethodName == ".ctor")
{
IMethodReturnMessage retMsg = (IMethodReturnMessage)this.NextSink.SyncProcessMessage(msg);
_realObj = (ObjRef)retMsg.ReturnValue;
return retMsg;
}
AOPBaseClass obj = (AOPBaseClass)RemotingServices.Unmarshal(_realObj);
return obj.SyncProcessMessage(this.NextSink, msg);
}
示例11: SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
IMethodMessage methodMessage = (IMethodMessage)msg;
if (methodMessage.MethodName == ".ctor") {
IMethodReturnMessage ret = (IMethodReturnMessage)m_NextSink.SyncProcessMessage(msg);
realobject = (ObjRef)ret.ReturnValue;
return ret;
} else {
AOPBaseClass obj = (AOPBaseClass)RemotingServices.Unmarshal(realobject);
return obj.SyncProcessMessage(m_NextSink, msg);
}
}
示例12: NotifyMarshaledObject
internal static void NotifyMarshaledObject(Object obj, ObjRef or)
{
ITrackingHandler[] handlers;
lock (_handlers.SyncRoot) {
if (_handlers.Count == 0) return;
handlers = (ITrackingHandler[]) _handlers.ToArray (typeof(ITrackingHandler));
}
for(int i = 0; i < handlers.Length; i++) {
handlers[i].MarshaledObject (obj, or);
}
}
示例13: MarshaledObject
internal static void MarshaledObject(object obj, ObjRef or)
{
try
{
ITrackingHandler[] handlerArray = _Handlers;
for (int i = 0; i < _Size; i++)
{
handlerArray[i].MarshaledObject(obj, or);
}
}
catch
{
}
}
示例14: SyncProcessMessage
/// <summary>
/// Synchronously processes the given message.
/// </summary>
/// <param name="msg">The message to process.</param>
/// <returns>
/// A reply message in response to the request.
/// </returns>
/// <exception cref="T:System.Security.SecurityException">
/// The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.
/// </exception>
public IMessage SyncProcessMessage(IMessage msg)
{
IMethodMessage methodMessage = (IMethodMessage)msg;
if (methodMessage.MethodName == ".ctor")
{
IMethodReturnMessage ret = (IMethodReturnMessage)_nextSink.SyncProcessMessage(msg);
_realObject = (ObjRef)ret.ReturnValue;
return ret;
}
else
{
AspectOrientedObject obj = (AspectOrientedObject)RemotingServices.Unmarshal(_realObject);
return obj.SyncProcessMessage(_nextSink, msg);
}
}
示例15: JobManagerFixture
public JobManagerFixture()
{
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
System.Collections.IDictionary ClientTcpChannelProperties = new System.Collections.Hashtable();
ClientTcpChannelProperties["name"] = "ClientTcpChan";
ChannelServices.RegisterChannel(
new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel(ClientTcpChannelProperties, new BinaryClientFormatterSinkProvider()), false);
int port = 35010;
System.Collections.IDictionary TcpChannelProperties = new System.Collections.Hashtable();
TcpChannelProperties["port"] = port;
try
{
chan = new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel(TcpChannelProperties, serverProv);
ChannelServices.RegisterChannel(chan, false);
server = new JobServerImpl();
serverRef = RemotingServices.Marshal(server, "JobServer");
server.handlersAdded.Set();
}
catch (SocketException e)
{
if (!e.Message.StartsWith("Only one usage of each socket address"))
{
throw;
}
}
}