Skip to content

rpc-from-scratch: is_prime_rpc_client.c#99,the data type of result has bug #3

@stardustman

Description

@stardustman

hello, I have read the rpc-from-scratch blog.It help me a lot to understand how rcp works. but when I compile the code then execute, I find whatever number I give to the client, the client always report is prime.
I change the int buf[1] to char buf[1], it works well.

  // Now, wait to receive the answer.
  int buf[1];  // Just receiving a single byte back that represents a boolean.  ---> char buf[1]
  int bytes_received = recv(sockfd, &buf, 1, 0);
  if (bytes_received == -1) {
    perror("recv");
    exit(1);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions