.


:




:

































 

 

 

 


. NET




 

System.Runtime.Remoting , - .NET
System.Runtime.Remoting.Activation , - ,
System.Runtime.Remoting.Channels ,
System.Runtime.Remoting.Channels.Http , HTTP
System.Runtime.Remoting.Channels.Ipc , - IPC (InterProcess Communication - ) Win 32. IPC - - , -
System.Runtime.Remoting.Services ( ), - -

 

 

, CLR - , , - .

.NET - : , , .

, -

, ( proxy-).

.NET , - . , . . -

.

, , - (transparent proxy). , CLR , , ( ). , - ,

. , , CLR , - .

System.Runtime.Remoting.Messaging.IMessage:

public inteface IMessage

{

IDictionary Properties {get;}

}

 

 

IMessage ( Prop- erties), , - . CLR , (real proxy).

, - . , ( ) , RealProxy. CLR - , - .

- , , IMessage- .

, , , , - . .NET :

1) TCP-;

2) HTTP-;

3) IPC-.

TCP- TcpChannel TCP/IP. Tcp- Channel , , . - , TCP- - , .

, HTTP-,

HttpChannel, SOAP (Simple Object Access Protocol ), SOAP. SOAP XML (eXtensible Markup Language ), , TcpChannel. HttpChannel . , HTTP - - 80.

IPC-, .NET IpcChannel, - IPC- . , IpcChannel - - , , HTTP- TCP-, , - . IpcChannel - , - .

IChannel, IChannelSender IChannelReceiver. IChannel , - . IChannelSender - , - , IChannelReceiver , - . -

 

ChannelServices.RegisterChannel(), , IChannel, :

// Http- 32469

HttpChannel c = new HttpChannel(32469); ChannelServices.RegisterChannel(c);

TcpChannel HttpChanne ,

- . -

, - . .NET, , , .

.NET - :

1) .

(, ), - .

2) . , .

3) .

, .

, - , , , , - , . -

, . , , CIL- (Common Intermediate Language ), ( ). , - :

1) , . - .NET, - , .

2) soapsuds.exe. ,

.

3) , - .

 

, :

1) SimpleRemoteingAsm.dll.

2) SimpleRemoteObjectClient.exe.

3) SimpleRemoteObjectServer.exe

8.1, 8.2, 8.3.

 

 

8.1. (*.dll )

using System;

using System.Collections.Generic;

using System.Text;

namespace SimpleRemotingAsm

{

//

//

publicclassRemoteMessageObject: MarshalByRefObject

{

public RemoteMessageObject()

{

Console.WriteLine(" RemoteMessageObject");

}

 

//

//

public void DisplayMessage(string msg)

{

Console.WriteLine(" {0}:", msg);

}

//

public string ReturnMessage()

{

return (" ");

}

}

}

 

8.2. ( )

using System;

using System.Runtime.Remoting;

using System.Runtime.Remoting.Channels;

using System.Runtime.Remoting.Channels.Http;

using SimpleRemotingAsm;

namespace SimpleRemoteObjcetServer

 

{

class SimpleObjServer

{

static void Main(string[] args)

{

Console.WriteLine("

SimpleRemoteObjectServer");

 

 

Console.WriteLine(" Enter");

// HTTPChannel HttpChannel c=new HttpChannel(32469); ChannelServices.RegisterChannel(c);

// WKO-

RemotingConfiguration.RegisterWellKnownServiceType

(typeof(SimpleRemotingAsm.RemoteMessageObject), "RemoteMsgObj.soap", WellKnownObjectMode.SingleCall); Console.ReadLine();

}

}

}

 

8.3. ( )

using System;

using System.Runtime.Remoting;

using System.Runtime.Remoting.Channels;

using System.Runtime.Remoting.Channels.Http;

using SimpleRemotingAsm;

namespace SimpleRemoteObjectClient

{

class SimpleObjClient

{

static void Main(string[] args)

{

Console.WriteLine("

SimleRemoteObjectClient");

Console.WriteLine(" <Enter>");

// Http-

HttpChannelc= newHttpChannel();

ChannelServices.RegisterChannel(c);

// WKO-

Object remoteObj=Activator.GetObject

(typeof(SimpleRemotingAsm.RemoteMessageObject), "http://localhost:32469/RemoteMsgObj.soap");

//

RemoteMessageObjectsimple=

 

(RemoteMessageObject)remoteObj; simple.DisplayMessage(" "); Console.WriteLine(" :{0}",

simple.ReturnMessage());

Console.ReadLine();

}

}

}

 

8.3.

, , - , (Chat). :

1) ;

2) , ;

3)

;

4) ( - );

5) .

 





:


: 2017-02-11; !; : 311 |


:

:

, .
==> ...

1528 - | 1299 -


© 2015-2024 lektsii.org - -

: 0.029 .