|
|
@ -36,8 +36,9 @@ int main() {
|
|
|
|
User* dest_users[MAX_CONNECTIONS] = {NULL};
|
|
|
|
User* dest_users[MAX_CONNECTIONS] = {NULL};
|
|
|
|
FD_ZERO(&read_fd_set);
|
|
|
|
FD_ZERO(&read_fd_set);
|
|
|
|
char buffer[BUFFER_SIZE];
|
|
|
|
char buffer[BUFFER_SIZE];
|
|
|
|
users = create_user_list("user_file.txt");
|
|
|
|
|
|
|
|
num_users = num_of_lines("user_file.txt");
|
|
|
|
num_users = num_of_lines("user_file.txt");
|
|
|
|
|
|
|
|
users = create_user_list("user_file.txt");
|
|
|
|
|
|
|
|
|
|
|
|
struct sockaddr addr_struct;
|
|
|
|
struct sockaddr addr_struct;
|
|
|
|
int server_sock = create_local(4,'T',"127.0.0.1",30000,&addr_struct);
|
|
|
|
int server_sock = create_local(4,'T',"127.0.0.1",30000,&addr_struct);
|
|
|
@ -131,7 +132,7 @@ User** create_user_list(char* filename) {
|
|
|
|
User** users = malloc (num_users * sizeof(User*));
|
|
|
|
User** users = malloc (num_users * sizeof(User*));
|
|
|
|
|
|
|
|
|
|
|
|
token = strtok(file_str," \r\n");
|
|
|
|
token = strtok(file_str," \r\n");
|
|
|
|
for (int i=0;i<num_users-1;i++) {
|
|
|
|
for (int i=0;i<num_users;i++) {
|
|
|
|
users[i]->username = strdup(token);
|
|
|
|
users[i]->username = strdup(token);
|
|
|
|
token = strtok(NULL," \r\n");
|
|
|
|
token = strtok(NULL," \r\n");
|
|
|
|
users[i]->password = strdup(token);
|
|
|
|
users[i]->password = strdup(token);
|
|
|
|