![]() If (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) = -1) ![]() PROBLEM: For each connection using fork(), the child process is copied over from parent and as you can see in the implementation below the client object with the same client id is copied over to the child process (at least this is what I think is happening).įor example: connecting to server using terminal 1 generates client id 83, and terminal 2 connection also sends id 83. client_t generate_client()Ĭlient_t *client = malloc(sizeof(client_t)) Ĭlient->clientID = randomClientIdGenerator() entryIndexConstant = 0 ![]() Right now, I have a function generate_client() that creates a client and gives it a random id number (that is returned to client). So each client connection is to be served on a new child process.
0 Comments
Leave a Reply. |