Answer the question
In order to leave comments, you need to log in
Rust, writing a chat server, how to be?
Good afternoon.
I got interested in server programming in Rust, found a small example:
https://github.com/Hoverbear/rust-rosetta/blob/mas...
Yes, everything is clear and cool. But I wanted more, namely a full-fledged chat server. (In the spirit of pure Rust and the use of its native functions). Then I will finish the client in another higher-level language (C#, Java).
The idea is the same, run a separate thread for a separate client, where the socket will listen and send messages. But how to be? How to run this thread correctly so that after receiving a message, send this message to all other users? Naturally, users need to be stored, let's say temporarily: in Vec, or in HashMap. But how do you access this shared socket listing from functions running on a thread?
I will be glad to have a working example to analyze it further.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question