在我问主要问题之前,我有两个基于套接字的现有客户端/服务器win32项目,其中客户端向服务器发送字符串请求,并使用套接字函数send(),recv( )
服务器代码的一部分(当前仍基于套接字)
struct client_ctx
{
int socket;
CHAR buf_recv[MAX_SEND_BUF_SIZE]; // receive buffer
CHAR buf_send[MAX_SEND_BUF_SIZE]; // send buffer
unsigned int sz_recv; // size of recv buffer
unsigned int sz_send_total; // size of send buffer
unsigned int sz_send; // size of data send
// OVERLAPPED structures for notifications of completition
OVERLAPPED overlap_recv;
OVERLAPPED overlap_send;
OVERLAPPED overlap_cancel;
DWORD flags_recv; // flags for WSARecv
};
struct client_ctx g_ctxs[1 + MAX_CLIENTS];
void schedule_write(DWORD idx)
{
WSABUF buf; buf.buf = g_ctxs[idx].buf_send + g_ctxs[idx].sz_send;
buf.len = g_ctxs[idx].sz_send_total - g_ctxs[idx].sz_send;
memset(&g_ctxs[idx].overlap_send,sizeof(OVERLAPPED));
WSASend(g_ctxs[idx].socket,&buf,1,NULL,&g_ctxs[idx].overlap_send,NULL);
}
使用上述功能,我将请求的数据发送到客户端
我从服务器发送的数据
static class SystemInfo{
public :
static std::string GetOSVersion();
static std::string getcurrentTimeStr();
static std::string GetTimeSinceStartStr();
static std::string GetFreeMemoryStr();
static std::string GetFreeSpaceStr();
static std::string Checkaccess();
static std::string CheckKeyFileDirectoryaccessRights(wchar_t *char_path,wchar_t *char_buf);
static std::string usernameFromSid(PSID userSid);
static BOOL FileOrDirectoryExists(LPCTSTR szPath);
};
问题是:关于如何使用Midl编译器将 SystemInfo 类中的方法表示为可以远程调用的过程,是否有任何指南?我找不到如何将现有功能与远程过程调用连接(在我的情况下是从客户端使用它们)
的任何手册。