pub struct RelayServer {
pub clients: Vec<Client>,
pub poller: Poller,
pub conn: Socket,
pub fd: RawSock,
pub buffer: Vec<MaybeUninit<u8>>,
pub client_timeout: Duration,
}Fields§
§clients: Vec<Client>§poller: Poller§conn: Socket§fd: RawSock§buffer: Vec<MaybeUninit<u8>>§client_timeout: DurationImplementations§
Source§impl RelayServer
impl RelayServer
Sourcepub fn new(
ip: impl Into<String>,
client_timeout: Duration,
) -> Result<Self, RelayServerError>
pub fn new( ip: impl Into<String>, client_timeout: Duration, ) -> Result<Self, RelayServerError>
Examples found in repository?
examples/server.rs (line 6)
5fn main() {
6 let mut server = RelayServer::new("0.0.0.0", Duration::from_secs(5)).unwrap();
7 println!("Server Created");
8
9 loop {
10 std::thread::sleep(Duration::from_millis(0));
11 server.step();
12 println!("L:");
13 for client in server.clients.iter() {
14 if let ClientStage::Registered(rclient) = &client.stage {
15 println!(
16 " Client: {}, session: {} adress: {:?}, ports: {:?}, to_connect: {:?}",
17 rclient.name, client.session, rclient.adress, rclient.ports, rclient.to_connect
18 );
19 }
20 }
21 }
22}pub fn avalibile_adress(&self, adress: &Adress) -> bool
pub fn create_session(&self) -> usize
pub fn listen(&mut self)
pub fn accept_new(&mut self)
pub fn process_client(&mut self, session: usize) -> Option<RawSock>
Sourcepub fn step(&mut self)
pub fn step(&mut self)
Examples found in repository?
examples/server.rs (line 11)
5fn main() {
6 let mut server = RelayServer::new("0.0.0.0", Duration::from_secs(5)).unwrap();
7 println!("Server Created");
8
9 loop {
10 std::thread::sleep(Duration::from_millis(0));
11 server.step();
12 println!("L:");
13 for client in server.clients.iter() {
14 if let ClientStage::Registered(rclient) = &client.stage {
15 println!(
16 " Client: {}, session: {} adress: {:?}, ports: {:?}, to_connect: {:?}",
17 rclient.name, client.session, rclient.adress, rclient.ports, rclient.to_connect
18 );
19 }
20 }
21 }
22}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RelayServer
impl RefUnwindSafe for RelayServer
impl Send for RelayServer
impl Sync for RelayServer
impl Unpin for RelayServer
impl UnwindSafe for RelayServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more