Struct msg_transmitter::tcp::TCPMsgServer[][src]

pub struct TCPMsgServer<T> {
    pub addr: SocketAddr,
    pub name: String,
    pub connections: Arc<Mutex<HashMap<String, Sender<Option<T>>>>>,
}

Fields

Methods

impl<T> TCPMsgServer<T> where
    T: DeserializeOwned + Serialize + Send + 'static + Clone
[src]

addr is socket address. like: 127.0.0.1:6666. name is the server's name, to identity which server it is.

first_msg is the first message that server send to the client which just connect to server. process_fuction receive a tuple of <client_name, message>, and return a series of tuple of (client_name,message) indicating which message will be sent to which client. Note that if you want to send a message to current client, you should set client_name as a string with 0 length, i.e. "" .

Trait Implementations

impl<T: Debug> Debug for TCPMsgServer<T>
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<T> Send for TCPMsgServer<T> where
    T: Send

impl<T> Sync for TCPMsgServer<T> where
    T: Send