mudbase_server

Crates.iomudbase_server
lib.rsmudbase_server
version0.1.0
sourcesrc
created_at2022-03-03 02:26:59.862301
updated_at2022-03-03 02:26:59.862301
descriptionA library for configuring and running a simple TCP server
homepagehttps://github.com/DrVonDevious/mudbase
repositoryhttps://github.com/DrVonDevious/mudbase
max_upload_size
id542701
size20,349
DrVonDevious (DrVonDevious)

documentation

README

Mudbase Server

mudbase_server is a sub-module of the Mudbase library that makes it
easier to start and configure a simple TCP server.

Example

use mudbase::server::{ ServerHandler, Sessions, SessionsType };

struct Server {
    sessions: SessionsType,
}

impl Server {
    fn new() -> Self {
        Self {
            sessions: Sessions::new(),
        }
    }
}

impl ServerHandler for Server {
    fn handle_message(message: &str, address: &str) {
      print!("{} says: {}", address, message);  
    }
}

fn main() {
    let server = Server::new();
    let listener = server.start("127.0.0.1", "7878");
    let sessions = server.sessions.clone();

    server.listen(listener, sessions);
}
Commit count: 41

cargo fmt