Class NetSocketTcpScenarioSender
Implementation of a ScenarioSender using .Net sockets over TCP
Inheritance
NetSocketTcpScenarioSender
Assembly: Xareus.Scenarios.Network.dll
Syntax
public class NetSocketTcpScenarioSender : AScenarioSender, INetSocketTcp, IDisposable
Fields
clientsRegistrations
Declaration
protected Dictionary<string, List<NetSocketTcpScenarioSender.ClientUpdateRegistration>> clientsRegistrations
Field Value
clientsRegistrationsForNewScenarios
Declaration
protected List<NetSocketTcpScenarioSender.ClientNewScenarioRegistration> clientsRegistrationsForNewScenarios
Field Value
serverSocket
Declaration
protected TcpListener serverSocket
Field Value
Properties
IsListening
Is the server currently listening (i.e. waiting for receivers)
Declaration
public bool IsListening { get; }
Property Value
IsReceiving
Declaration
public bool IsReceiving { get; set; }
Property Value
OnConnected
Event fired when a receiver connected
Declaration
public EventHandler OnConnected { get; set; }
Property Value
OnDisconnected
Event fired when a receiver disconnects
Declaration
public EventHandler OnDisconnected { get; set; }
Property Value
Methods
AcceptCallback(IAsyncResult)
This is the method called when a new receiver connected
Declaration
protected virtual void AcceptCallback(IAsyncResult ar)
Parameters
ConvertToParameter<T>(T, IContext)
Convert an object to a parameter using the given external context
Declaration
protected virtual Parameter ConvertToParameter<T>(T eventContext, IContext externalContext)
Parameters
Type |
Name |
Description |
T |
eventContext |
|
IContext |
externalContext |
|
Returns
Type Parameters
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
bool |
disposing |
|
~NetSocketTcpScenarioSender()
Declaration
protected ~NetSocketTcpScenarioSender()
HandleClientRequest(TcpClient, string)
Declaration
protected virtual void HandleClientRequest(TcpClient client, string data)
Parameters
PostRegisterToScenario(Scenario)
Declaration
protected override void PostRegisterToScenario(Scenario scenario)
Parameters
Overrides
ScenarioChange(string, ScenarioState)
Declaration
protected override void ScenarioChange(string scenarioInstanceId, ScenarioState scenarioState)
Parameters
Overrides
SendExternalScenarios(Scenario, TcpClient)
Send all external scenarios of the current scenario. No need for recursion, we check all the sequences.
Declaration
protected virtual void SendExternalScenarios(Scenario scenarioToSend, TcpClient client)
Parameters
StartListenTask(CancellationTokenSource)
This is the task where the Sender wait for new receivers to connect
Declaration
protected void StartListenTask(CancellationTokenSource tokenSource = null)
Parameters
StartServer(int)
Start the server (listening for receivers) on the given port
Declaration
public void StartServer(int port = 7777)
Parameters
Type |
Name |
Description |
int |
port |
|
StopServer()
Declaration
TransitionFired(string, Transition, IContext, IContext, IContext, IContext)
Declaration
protected override void TransitionFired(string scenarioInstanceId, Transition transition, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Overrides
Events
OnConnectedEvent
Event fired when a receiver connected
Declaration
public event EventHandler OnConnectedEvent
Event Type
OnDisconnectedEvent
Event fired when a receiver disconnects
Declaration
public event EventHandler OnDisconnectedEvent
Event Type
Implements