I am doing a project for class as you may already know which is a multi-user chat program. I am in the final stages of writing the code or in a better saying I am trying to get rid of the errors that prevent me from running it. Several of the errors complain of when I call a member function of a class (have to use a class blah!) and the compiler confuses it with a structure call:
Code:
Error E2294 SERVER.CPP 92: Structure required on left side of . or .* in functio
n main()
FD_SET(newfd, &master); // Add to set
if (newfd > fdmax) // Keep track of the maximum
fdmax = newfd;
announ = newuser( i );
tserv.announce(announ, fdmax, listener);
// Print status to console
cout << "selectserver: new connection from " << inet_ntoa(client.sin_addr) << " on socket " << newfd << endl;
Also I get this error:
Code:
Error E2034 list.h 122: Cannot convert 'int' to 'char *' in function newuser(int
,sockaddr *)
char *newuser( int sockfd, struct sockaddr *info )
{
char *ip, *tmp;
int sin_size = sizeof( info );
recv( sockfd, tmp, length, 0);
if( getpeername( sockfd, ( struct sockaddr *)&info, &sin_size ) == 0 )
cout << "Invalid client" ;
else
{
ip = inet_ntoa( info.sin_addr );
adduser( ip, tmp );
}
return *tmp;
}
Help is apprieciated.