Before I ask the main question, I have two existing client/server win32 projects based on sockets in which the client sends a string request for the server and receives the result as a string using socket functions i.e. send(), recv()
a part of the server code (currently still based on sockets)
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, 0, sizeof(OVERLAPPED));
WSASend(g_ctxs[idx].socket, &buf, 1, NULL, 0, &g_ctxs[idx].overlap_send, NULL);
}
And using the above functions I send the requested data to the client
The data I send from the server
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);
};
And the question is: is there any guide on how can I use the midl compiler to be able to represent the methods from SystemInfo class as procedures that can be called remotely? I can't find any manual of How to connect the existing functions with the remote procedure calls (and use them from the client side in my case)