A complete example of. Net remoting Event Callback client Function Method: C # implement console remoting chatroom)

Source: Internet
Author: User

A complete example of. Net remoting Event Callback client Function Method: C # implement console remoting chatroom)
Http://chs.gotdotnet.com/quickstart/howto/doc/Remoting/quickstart.aspx
Three different methods for parsing client references to remote objects during compilation are as follows:
1.
When compiling the client, compile the Server Object and specify EXE or dll as a reference to the compiler. This method is useful if both client and server components are developed in the same location.
2.
Derive server objects from the interface class and compile the client using the interface. This method is useful if the client and server components are not developed in the same location. You can compile the interface as a DLL and send it to the client location as needed. Changes to released interfaces should be avoided. For more information, see the com guide.
3.
Use soapsuds to extract the required metadata from the running server object. This is useful if the client and server components are developed in different locations and there are no available interface classes. Point the soapsuds tool to a remote Uri and generate the required metadata as a source or DLL. Note that the soapsuds tool only extracts metadata and does not generate a remote object source.

This example usesMethod 2
.Net remoting implements a simple console chat room

Set Program It consists of the server and client programs respectively:
Server side:
1. \ remotingchatroom \ Server \ Share. CS
Csc.exe/T: Library c: \ remotingchatroom \ Server \ chatroom. CS
Generated Share. Dll The remoting service class that is deployed on the server and provided to the client.
2. \ remotingchatroom \ Server \ Receiver. CS
Csc.exe/T: Library c: \ remotingchatroom \ Server \ receiver. CS
Generated Receiver. dll Deployed on the server side. In this case, the server and client have the following roles:
The consumer object of the client must also provide remote services for the server, and the proxy class is enough.
3. \ remotingchatroom \ Server \ Server. CS
Csc.exe c: \ remotingchatroom \ Server. CS
Generated Server.exe Is the main program of the remoting server.
4. \ remotingchatroom \ Server \ S. config
Remoting configuration file on the server

Client Side:
1. \ remotingchatroom \ Client \ Share. CS
Csc.exe/T: Library c: \ remotingchatroom \ Client \ chatroom. CS
Generated Share. Dll Deployed on the client,
The chatroom class of this Assembly is only the proxy class of the chatroom class of the corresponding assembly on the remote server side:
Only the signature of the namespace method must be consistent with that of the server.
Of course, you can also directly deploy the complete remote object class assembly on the server side on the client side.
2. \ remotingchatroom \ Client \ Sender. CS
Csc.exe/R: Share . Dll c: \ remotingchatroom \ Client \ sender. CS
Generated Sender.exe Is the remoting client used to speak.
3. \ remotingchatroom \ Client \ Receiver. CS
Csc.exe/R: chatroom. dll c: \ remotingchatroom \ Client \ receiver. CS
Generated Receiver.exe Is the remoting client used to receive all speeches.

Note the program annotations.

full instance download:
http://files.cnblogs.com/Microshaoft/RemotingChatRoom.rar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.