pub struct S7Server { /* private fields */ }Expand description
TCP listener that accepts connections and runs the full S7 pipeline per connection.
Implementations§
Source§impl S7Server
impl S7Server
Sourcepub async fn bind(config: ServerConfig) -> Result<Self>
pub async fn bind(config: ServerConfig) -> Result<Self>
Bind a TCP listener at config.bind_addr.
Sourcepub async fn start_to(addr: &str, max_connections: usize) -> Result<Self>
pub async fn start_to(addr: &str, max_connections: usize) -> Result<Self>
Bind to a specific address string (e.g. "0.0.0.0:102").
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Return the local address the server is listening on.
Sourcepub async fn serve(self, store: DataStore) -> Result<()>
pub async fn serve(self, store: DataStore) -> Result<()>
Accept connections and serve them against store until an accept error occurs.
Sourcepub fn get_status(store: &DataStore) -> ServerStatus
pub fn get_status(store: &DataStore) -> ServerStatus
Return server/CPU status and connected client count.
Sourcepub fn set_cpu_status(store: &DataStore, state: CpuState)
pub fn set_cpu_status(store: &DataStore, state: CpuState)
Set the simulated CPU state.
Sourcepub fn lock_area(store: &DataStore, area_code: u8)
pub fn lock_area(store: &DataStore, area_code: u8)
Lock an area: writes to this area are silently ignored until unlocked.
Sourcepub fn unlock_area(store: &DataStore, area_code: u8)
pub fn unlock_area(store: &DataStore, area_code: u8)
Unlock a previously locked area.
Sourcepub fn clear_events(store: &DataStore)
pub fn clear_events(store: &DataStore)
Drain the event queue.
Sourcepub fn pick_event(store: &DataStore) -> Option<EventInfo>
pub fn pick_event(store: &DataStore) -> Option<EventInfo>
Pop the oldest event from the queue. Returns None when empty.
Auto Trait Implementations§
impl !Freeze for S7Server
impl RefUnwindSafe for S7Server
impl Send for S7Server
impl Sync for S7Server
impl Unpin for S7Server
impl UnsafeUnpin for S7Server
impl UnwindSafe for S7Server
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