📄 client.cpp
字号:
//
// SMPC Client example
// SIC Dynamics Copyright(C) - 1999
//
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <smpc/dsmpccli.h>
class TestClient : public DSmpcClient
{
private:
char about[100];
public:
TestClient(DSmpc* smpc, dword sid) : DSmpcClient(smpc,sid,3) {}
char* About(void) { return DSmpcClient::About(about,sizeof(about)); }
int Test(void* buffer, dword& size)
{
DSmpcParam param;
SmpcSet(¶m,buffer,size);
Call(1,¶m,1,¶m,1);
size = param.size;
return Error();
}
dword Type(void) const { return RemoteType(); }
};
char buffer[1000000];
void main(int argc, char* argv[])
{
DSmpc* smpc = CreateSmpc();
TestClient test(smpc,argc < 2 ? 13 : atoi(argv[1]));
printf("About %lu: ",test.Sid()); fflush(stdout);
char* about = test.About();
if(about) {
printf("'%s' type %lu\n",about,test.Type());
puts("Press any key to call test ..."); getch();
for(dword i = 0, size; i <= sizeof(buffer); i += 10000) {
printf("Call with %lu bytes\n",i);
test.Test(buffer,size = i);
printf("Return: %s with %lu bytes\n",smpc_error(test.Error()),size);
}
} else printf("Error: %s\n",smpc_error(test.Error()));
delete smpc;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -