In C, to receive/send data you usually do(roughly):

Server:

* Create socket
* Bind socket to port
* listen
* Accept
* Receive Send data

On client side:

* Create socket
* Connect
* Receive send

My question comes **after** server has done `accept`.

Imagine **after** `accept` on the server side there are three separate lines
to send data:

```
connfd = accept(listenfd, (struct sockaddr*)NULL ,NULL);
write(connfd, var1, var1Size);
write(connfd, var2, var2Size);
write(connfd, var3, var3Size);

```

Does this mean on the client side I need to have three reads?
Like this:

```
read(sockfd, &x, size1);
read(sockfd, &y, size2);
read(sockfd, &z, size3);

```

In other words how should send and receive calls correspond
on server and client side? Should for each send be a corresponding receive on the client side?

What if on client side, after 3 read calls(like above), I want to send data to server?
Shall I just add one new send and one new receive on client and server side respectively?

Should all these send/receives be happening within a single `accept` call context?

Here is a image to better illustrate what kind of scenario I could be interested in:

![enter image description here](https://i.stack.imgur.com/DVtF3.png)

Pseudo code explaining how to handle this kind of connections would be welcome.