本文介绍了继续2:从套接字编程中调用算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经将测试列表"的完整定义剪切并粘贴到winsock2server.cpp,并且还在winsock2server.cpp中包括了"router.h"(这对于可见的路由器定义),但是仍然不起作用.
在我的算法中,main.cpp文件为:
I have cut-and-paste the full difinition of "testlist" to the winsock2server.cpp, and also include" router.h" in the winsock2server.cpp( this is for router definition visible), but still does not work.
in my algorithm, the main.cpp file as:
#include <iostream>
#include <string>
using namespace std;
#include "router.h"
template <typename T>
void testList(Router < T > &listObject, const string &typeName)
{
cout <<" Testing a list of " << typeName << " values \n";
instructions ();
int choice;
T value;
do
{
cout << "?";
cin >> choice;
switch (choice)
{
case 1:
cout << "enter" << typeName <<":";
cin >> value;
listObject.Register(value);
listObject.print();
break;
case 2:
cout << "enter" << typeName <<":";
cin >> value;
listObject.sendRegistration(value);
listObject.print();
break;
case 3:
if (listObject.sendRegistrationCancellation(value))
cout << value <<" removed from list\n";
listObject.print();
break;
case 4:
if (listObject.sendCancellationConfirmation(value))
cout << value <<" removed from list\n";
listObject.print();
break;
}
} while (choice != 5);
cout << "End list test \n\n";
}
void instructions ()
{
cout << "enter one of the following:\n"
<< " 1 to register node to the list\n"
<< " 2 to sendRegistration to the node \n"
<<" 3 to sendRegistrationCancellation to the list\n"
<<"4 to end list processing \n";
}
int main ()
{
Router <int> integerRouter;
testList ( integerRouter, "integer");
Router < double> doubleRouter;
testList ( doubleRouter, "double");
return 0;
}
</int>
我想在服务器中调用此算法,所以我放
I want to call this algorithm in the server, so i put
Router <int> integerRouter;
testList ( integerRouter, "integer");
Router <double> doubleRouter;
testList ( doubleRouter, "double");
在winsock2.server中,尝试调用无法成功实现.
in the winsock2.server, to try to call,cannot implement sucessfully.
推荐答案
Router integerRouter;
?
干杯,
灰
?
Cheers,
Ash
这篇关于继续2:从套接字编程中调用算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!