Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Beginners » Downloads
 
Add your own
alternative version

Dot Remoting - Server Activated, SingleCall Technique

, 11 Jan 2011 CPOL
Shows how you can create remote objects and access it from client. Here, it is server activated single call technique
RemotingEx01.zip
ConServer
ConServer
bin
Debug
ConServer.exe
ConServer.vshost.exe
ClassDiagram1.cd
Properties
RemClient
RemClient
bin
Debug
ConServer.exe
RemClient.exe
RemClient.vshost.exe
Properties
Settings.settings
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

//RemoteClient_001: Include the required namespace
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using ConServer;

namespace RemClient
{
    public partial class RemoteClient : Form
    {
        public RemoteClient()
        {
            InitializeComponent();
        }

        private void btnInvokeRemote_Click(object sender, EventArgs e)
        {
            //RemoteClient_002: Get the remote object on the server
            RemCustomer remoteCust = (RemCustomer)Activator.GetObject(typeof(RemCustomer), "tcp://localhost:13340/RemCustomer");

            //RemoteClient_003: Get Customer Id and Name exposed by the remote object itself
            int id = remoteCust.Get_id();
            string name = remoteCust.Get_Name();

            //RemoteClient_004: Get Some other object from the server through the remote
            //object. Note the object should be serializable.
            LastTrans trans = remoteCust.GetLastTrans();
            int lastdeposit = trans.GetLastDeposit();
            int lastwithdraw = trans.GetLastWithdraw();

            //RemoteClient_005: Display the information retrieved
            txtCustId.Text  = id.ToString();
            txtCustName.Text  = name;
            txtLastDeposit.Text = lastdeposit.ToString();
            txtLastWithdraw.Text = lastwithdraw.ToString();
            btnInvokeRemote.Enabled = false;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sivaraman Dhamodharan
Software Developer iSOFT
India India
I am working as software engineer in iSOFT R&D. I have been come accross C++,MFC, .net technologies. I do like playing video games, reading books.
 

Web: www.mstecharticles.com


| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 12 Jan 2011
Article Copyright 2011 by Sivaraman Dhamodharan
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid