In Brief

In this chapter, we took a look at multithreading and remoting. Here's an overview of the topics:

  • Multithreading is all about hosting multiple threads in addition to an application's main thread, and using them as multiple streams of execution. You can create new threads with the Thread class. This class has various methods you can use to control threads: Start , Suspend , Resume , Sleep , Join , Abort , and so on.

  • You can give a thread its own code by placing that code in a method, which you pass to the Thread constructor. Do not handle user interface elements like forms or controls in any thread but the main one.

  • You can synchronize threads with lock and Monitor statements, avoiding conflict when threads use shared resources.

  • Remoting is the technique of passing objects across process or machine boundaries. By basing a class on MarshalByRefObject , you can export that type from the server to the client. And you can use the HttpChannel to communicate between the server and the client.

  • You can also send an object (not just a type) from the server to the client. In that case, you use the RemotingServices.Marshal method.

  • SOAP provides another mechanism for remoting. You can use the SoapFormatter class in the server to serialize an object to disk, for example, and this same class's Deserialize method to connect to the server.

Microsoft Visual C#. NET 2003 Kick Start
Microsoft Visual C#.NET 2003 Kick Start
ISBN: 0672325470
EAN: 2147483647
Year: 2002
Pages: 181

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: