This is a server that asks for the client's username.
struct sockaddr_in *self = init_server_addr(PORT);
	int listenfd = set_up_server_socket(self, 5);

	while (1)
	{
		int fd = accept_connection(listenfd);
		if (fd < 0)
		{
			continue;
		}

		// Receive messages
		char buf[INPUT_BUFFER_SIZE] = {'\0'};
		int inbuf = 0;			// How many bytes currently in buffer?
		int room = sizeof(buf); // How many bytes remaining in buffer?
		char *after = buf;		// Pointer to position after the data in buf

		User *user_list = NULL; // Create the heads of the empty data structure
		char input[INPUT_BUFFER_SIZE];
		int received_username_flag = 0;

		printf("What is your user name?\n"); // get username

		int nbytes;
		while ((nbytes = read(fd, after, room)) > 0)
		{
			// Step 1: update inbuf (how many bytes were just added?)
			inbuf += nbytes;
			int where;

			// Step 2 determine if a full line has been read from the client
			while ((where = find_network_newline(buf, inbuf)) > 0)
			{
				// Step 3 get full input
				if (where >= 2 && inbuf > 0)
				{
					buf[where - 2] = '\0';
				}

				if (received_username_flag == 0) // get username in first input
				{
					// search for username in user_list
					int create_user_output = create_user(buf, &user_list);
					if (create_user_output == 1)
					{ // user already exists
						printf("Welcome back.\n");
						printf("Go ahead and enter user commands>");
					}
					else if (create_user_output == 2)
					{ // if the given name cannot fit in the 'name' array
						perror("Error: name too long");
						exit(1);
					} else { // new user
						printf("Welcome.\n");
						printf("Go ahead and enter user commands>");
					}
					received_username_flag++;
				}

				// Step 4 update inbuf and remove the full line from the buffer
				inbuf -= where;
				memmove(buf, &(buf[where]), inbuf);
			}

			// Step 5: update after and room, in preparation for the next read.
			after = &(buf[inbuf]);
			room = sizeof(buf) - inbuf; // inbuf + room = sizeof(buf)
		}
	}