Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
thank you Ash and CPallini.
I put the code here which occurs the error,
C++
int WinSock2Server::STEP5_ReceiveAndSendData(SOCKET ClientSocket){
char recvbuf[DEFAULT_BUFLEN];
int recvbuflen = DEFAULT_BUFLEN;
char sendbuf[DEFAULT_BUFLEN];
int sendbuflen = DEFAULT_BUFLEN;
int iResult, iSendResult;

// Receive until the peer shuts down the connection
do {
iResult = recv(ClientSocket, recvbuf, recvbuflen, 0);
if (iResult > 0) {
recvbuf[iResult]= '\0';
printf("Clinet>%s [%d]\n", recvbuf, iResult);
//
//*if (iresult==recvbuf)
// Ended
Router integerRouter;
testList ( integerRouter, "integer");
Router doubleRouter;
testList ( doubleRouter, "double");

// Echo the buffer back to the sender
strcpy(sendbuf, "echo:");
strcat(sendbuf,recvbuf);
sendbuflen = strlen(sendbuf);
iSendResult = send( ClientSocket, sendbuf, sendbuflen, 0 );
if (iSendResult == SOCKET_ERROR) {
printf("Server$>Error while sending data [%d]\n", WSAGetLastError());
closesocket(ClientSocket);
WSACleanup();
return 1;
}
printf("Server$>%s [%d]\n", iSendResult);
}
else 
if (iResult == 0){
printf("Connection closing...\n");
}
else {
printf("recv failed: %d\n", WSAGetLastError());
closesocket(ClientSocket);
WSACleanup();
return 1;
}
} while (iResult > 0);
}

this is one of functions of socket programming--send and receive data. In the middle of the code, there are "router ,integer router", and testList...
when i run this program, it occurs errors as (it shows the 'testList':identifier not found,"testlist"is my algorithm function):

1>c:\documents and settings\lina\desktop\winsock2-basicclientserver1\winsock2-basicclientserver\winsock2server\server\winsock2server.cpp(134) : error C3861: 'testList': identifier not found1>c:\documents and settings\lina\desktop\winsock2-basicclientserver1\winsock2-basicclientserver\winsock2server\server\winsock2server.cpp(137) : error C3861: 'testList': identifier not found1>c:\documents and settings\lina\desktop\winsock2-basicclientserver1\winsock2-basicclientserver\winsock2server\server\winsock2server.cpp(144) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data1>Generating Code...
Posted
Updated 2-Oct-10 20:49pm
v2
Comments
Sandeep Mewara 3-Oct-10 2:50am    
Not sure if you this is a continuation of some other question or you are asking this specific to an article. Looks like the question is specifically for two people. Can you edit and elaborate on it? A link to question/answer being referred would be good.
Richard MacCutchan 3-Oct-10 3:43am    
So where is 'testList' defined? According to the compiler it does not have any idea what it is.

1 solution

Information for other CPians, the original question is here[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900