⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.cpp

📁 Visual C++.net编成指南一书的源代码
💻 CPP
字号:
// 这是使用应用程序向导生成的 VC++ 
// 应用程序项目的主项目文件。

#include "stdafx.h"

#using <mscorlib.dll>
#using <mscorlib.dll>
#using <System.dll>
#using <System.Xml.dll>
#using <System.Data.dll>
#using <System.Runtime.Remoting.dll>

#using "shareInterface.dll"
#include <tchar.h>

using namespace System;
using namespace System::Data;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
using namespace shareInterface;
// 这是此应用程序的入口点
int _tmain(void)
{
	//注册信道
      TcpChannel* chan = new TcpChannel();
	  ChannelServices::RegisterChannel(chan);
	  IService* service =  (IService*)Activator::GetObject(
		Type::GetType("shareInterface.IService,shareInterface"),
		 "tcp://localhost:8085/MyRemoteObj");
	  if(service==NULL)
		  Console::WriteLine("不能获得远程对象!");
	  else
	  {
		Console::WriteLine(service->GetGreeting("晓华"));
		DataSet* ds=service->GetDataSet();
		DataTable* tb=ds->Tables->get_Item(0);
		for(int i=0;i<tb->Rows->Count;i++)
		{
			Console::WriteLine("{0}\t{1}",tb->Rows->get_Item(i)->get_Item(0),tb->Rows->get_Item(i)->get_Item(1));
		}	
	  }
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -