C # +. net uses remobjects to create a client server

Source: Internet
Author: User

Create client projects respectivelyRotestclient, Server projectRotestserver

The paths areRotest \ ClientAndRotest \ Server

Start from the server and useServicebuilderServer Creation Method

Create a new service

NameTestservice, Click"Add operation"Create a New Method

Create a new method"Appendstring", IncludingA, BTwo string parameters. The return value is a string.String

Close the dialog box and save itRotest \ ServerDirectory,Name the file"Testservice"

ToRotestserverProject Add Server definition file, right-click, add, existing item

Select "all files" and select"Testservice. rodl"

After adding, only includeRodlFile

Double-clickRodlFile, and close it to generate an interface file

GenerateRotestserverThe prompt is displayed because the interface method is not implemented.

Locate the error location to implement this method

Open ServerForm1Form, drag inIPtcpserverchannelAndBinmessageWidget

ToIptcpserverchannel1AddDispatcher,MessageSelectBinmessage1

Iptcpserverchannel1OfActiveSet propertyTrue

After the server is configured, set the client

Open the clientForm1Form, drag inIPtcpclientchannelAndBinmessageWidget,And a buttonButton

Iptcpclientchannel1OfHostnameUsed for communication with the server.IPAnd settings (such as serverProgramIn192.168.0.100, Set192.168.0.100In this example, the default value isLocalhost

 

NextRotestclientProject import interface file, right-clickRotestclientProject, add, existing project, find

RotestserverDirectoryINTFFile, add as Link

On the button write to click events

private void button#click ( Object sender, eventargs E)

{

string append = cotestservice . create (binmessage1, iptcpclientchannel1 ). appendstring ( " hello, " , " world " );

MessageBox. Show (append );

}

So far, the client settings are complete.

Separate rotestserver.exeand rotestclient.exe

Click the client's button1 to return the result.

So far, a typical client/server program supported by remobjects has been completed.

 

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.