How to Send Messages by Client in Socket Communication with Multiple Clients

Asked 2 years ago, Updated 2 years ago, 83 views

I'm learning how to create a program that can communicate with multiple clients using a socket in C language.After preparing the parent and child sockets using the Fork and pipe functions, we are trying to communicate between processes through pipes.What else can I use to send them separately to each client?For example, what should I do if I want to send it to the player sequentially saying, "Now it's your turn" on multiple game communications?
I checked various things such as whether I can send messages in order using the select function, but I didn't understand it well, so I would appreciate it if you could give me some advice.

c socket

2022-09-30 15:33

2 Answers

As you can see in the comments, why don't you actually cord it and move it?
I don't know what you want to hear or what you're making a problem with


2022-09-30 15:33

Generally, if you want to create a program like this
Instead of directly communicating with sockets, using a message queue such as Kafka is
It's efficient.

Whether or not the communication partner's process is occurring, management of the increase or decrease of the communication partner, etc.
If you do it yourself, the amount of writing will increase, so you can implement it cheaply by using the existing device.

I'm sorry for the direct answer, but please understand it as one of the reasons.

It seems to be rather troublesome and I have a lot to memorize, such as sending a message from C to REST...

https://kafka.apache.org/documentation/


2022-09-30 15:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.