Table of Contents

Class CentralRetransmissionServer

Namespace
UdpChat.Server
Assembly
UdpChat.Server.dll

The central retransmission server for the chat system. It handles auth requests and retransmission of messages.

public class CentralRetransmissionServer
Inheritance
CentralRetransmissionServer
Inherited Members

Constructors

CentralRetransmissionServer(int, int)

Creates a new retranmission server with the specified ports

public CentralRetransmissionServer(int registerPort = 5000, int retransmissionPort = 5001)

Parameters

registerPort int
retransmissionPort int

Properties

AuthenticationService

public ServerService AuthenticationService { get; set; }

Property Value

ServerService

RetransmissionService

public ServerService RetransmissionService { get; set; }

Property Value

ServerService

Methods

LoginUserAsync(string, string, string, int)

Async database query to check if a user exists and has the correct password

public Task<bool> LoginUserAsync(string name, string password, string ipAddress, int port)

Parameters

name string
password string
ipAddress string
port int

Returns

Task<bool>

An awaitable task which resolves to true if the user exists and has the correct password, false otherwhise

Exceptions

ChatDatabaseNotInitializedException
UserAlreadyLoggedInxception

RegisterUserAsync(string, string, string, int)

public Task RegisterUserAsync(string name, string password, string ipAddress, int port)

Parameters

name string
password string
ipAddress string
port int

Returns

Task

Exceptions

ChatDatabaseNotInitializedException
UserAlreadyRegisteredException

Start()

Starts the server with the associated services:

public void Start()

Remarks

StartAuthenticationService()

Sets the AuthenticationService This service is responsible for all authentication operations.

public void StartAuthenticationService()

Remarks

Starts a ServerService in localhost (127.0.0.1)with the specified port AuthenticationPort.

StartRetransmissionService()

Sets the RetransmissionService. This service is responsible for receiving messages from clients and retransmitting them to the all registered users.

public void StartRetransmissionService()

Remarks

Starts a ServerService in localhost (127.0.0.1)with the specified port RetransmissionPort.

Stop()

Stops the services and closes the database connection

public void Stop()