I have the following problem: I have a header file with the class "Connection" in the namespace "ns". The Connection class has a connect function that uses the Winsock connect function internally. Now, when I want to define a function in a .cpp file, I get an error due to incorrect parameters. For example, he does not want to βuseβ the connection function from the winsock api, just a member function.
Looks like this .cpp file: (not final)
bool ns::Connection::connect(char IP[],unsigned short Port) { SOCKADDR_IN server_addr; memset(&server_addr,0,sizeof(SOCKADDR_IN)); server_addr.sin_family = AF_INET; server_addr.sin_port = Port; server_addr.sin_addr.s_addr = inet_addr((const char*)IP); connect(client,&server_addr,0);
I appreciate your help, thanks!
c ++ function class member
Hannes hauptmann
source share