Interface INetworkServerManager

All Known Implementing Classes:
NetworkServerManager

public interface INetworkServerManager
A Network Server Manager is an active object ( a thread ) that send and receive messages from clients. There is not transport or technology imposed.

The Network Manager is our router that sends and receives messages to and from the network. The manager exposes the interfaces that allow:

  • Reading a message from the network
  • Sending a message to the network
  • Finalizing the manager
Now lets get back to the interface as exposed to other objects.
The Write method is immediate, just call it with the message to send, making sure that you have correctly filled SourceAddress and ClientID. The message will then be sent to the Client. The Read method is blocking, when you call the Read method it either returns a message from the queue or if the queue is empty the thread blocks (sleeps) until one arrives.
Author:
miguel
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method disconnect a client or silently fails if client doesn't exists.
    void
    This method notify the active object to finish it execution
    getChannel​(Object internalChannel)
    gets the channel associated with an internalChannel
    This method blocks until a message is available
    This method provides the connection validator object.
    void
    Register a listener that will be called when a disconnected event happens.
    void
    This method add a message to be delivered to the client the message is pointed to.
    void
    This method inits the active object
  • Method Details

    • registerDisconnectedListener

      void registerDisconnectedListener(IDisconnectedListener listener)
      Register a listener that will be called when a disconnected event happens. It is up to the implementer if this call add or replace the actual listener.
      Parameters:
      listener - a listener of disconnection events.
    • getValidator

      ConnectionValidator getValidator()
      This method provides the connection validator object. You can use it to ban connection IP.
      Returns:
      validator.
    • getMessage

      Message getMessage()
      This method blocks until a message is available
      Returns:
      a Message
    • sendMessage

      void sendMessage(Message msg)
      This method add a message to be delivered to the client the message is pointed to.
      Parameters:
      msg - the message to be delivered.
    • disconnectClient

      void disconnectClient(Channel channel)
      This method disconnect a client or silently fails if client doesn't exists.
      Parameters:
      channel -
    • start

      void start()
      This method inits the active object
    • finish

      void finish()
      This method notify the active object to finish it execution
    • getChannel

      Object getChannel(Object internalChannel)
      gets the channel associated with an internalChannel
      Parameters:
      internalChannel - internel channel
      Returns:
      Channel