Home Units Hierarchy Routines All identifiers

Class unavclIPServer

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unavclIPServer = class(unavclInOutIpPipe)

Description

IP Server: initiates listening socket for clients to connect to. Receives and sends audio stream to/from client.

Usage: set proto and port properties to specify the socket parameters. Set active to true or call the open() method to initiate the server.

Example: refer to vcTalkNow demo, with ip_server it is possible to accept client connections, receive compressed audio stream and send audio stream over network.

Hierarchy

Overview

Methods

Public function getClientConnId(clientIndex: int): tConID;
Public function getClientOptions(clientIndex: int): uint;
Protected function doSendPacket(connId: tConID; cmd: uint; out asynch: bool; data: pointer = nil; len: uint = 0; timeout: tTimeout = 82): tunaSendResult; override;
Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override;
Protected function handleSocketEvent(event: unaSocketEvent; id, connId: tConID; data: pointer; len: uint): bool; override;
Protected function initSocksThread(): tConID; override;
Protected function onNewPacket(cmd: uint; data: pointer; len: uint; connId: tConID; worker: uint): bool; override;
Public procedure AfterConstruction(); override;
Public procedure BeforeDestruction(); override;
Public procedure setClientOptions(clientIndex: int; options: uint = c_unaIPServer_co_default);
Protected procedure addDeadSocket(connId: tConID);
Protected procedure doAcceptClient(connId: tConID; var accept: bool); virtual;
Protected procedure doClose(); override;
Protected procedure doServerClientConnection(connId: tConID; isConnected: bool); virtual;
Protected procedure sendGoodbye(connId: tConID); override;

Properties

Public property clientCount: unsigned read getClientCount;
Public property clientOptions[clientIndex:int]: uint read getClientOptions write setClientOptions;
Published property confMode: unaIpServerConferenceMode read f_confMode write f_confMode default uipscm_oneToMany;
Published property isFormatProvider default true;
Published property maxClients: int read f_maxClients write setMaxClients default 1;
Published property onAcceptClient: tunavclAcceptClient read f_onAcceptClient write f_onAcceptClient;
Published property onServerClientDisconnect: tunavclConnectEvent read f_onServerClientDisconnect write f_onServerClientDisconnect;
Published property onServerNewClient: tunavclConnectEvent read f_onServerNewClient write f_onServerNewClient;
Public property packetStackThreadEnabled: bool read f_psEnabled write f_psEnabled;
Published property udpTimeout: tTimeout read f_udpTimeout write f_udpTimeout default c_defUdpConnTimeout;

Description

Methods

Public function getClientConnId(clientIndex: int): tConID;

Returns connId for client connection with given index.

Parameters
clientIndex
Index of client connection (from 0 to clientCount - 1).
Public function getClientOptions(clientIndex: int): uint;

Returns flags assigned for a client.

Parameters
clientIndex
Index of client connection (from 0 to clientCount - 1).
Protected function doSendPacket(connId: tConID; cmd: uint; out asynch: bool; data: pointer = nil; len: uint = 0; timeout: tTimeout = 82): tunaSendResult; override;

Sends a packet to specified client.

Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override;

Writes data into the TCP/IP stream to be sent to client(s).

Protected function handleSocketEvent(event: unaSocketEvent; id, connId: tConID; data: pointer; len: uint): bool; override;

Handles specific events reveived from server component.

Protected function initSocksThread(): tConID; override;

Initializates sockets thread to be used with server.

Protected function onNewPacket(cmd: uint; data: pointer; len: uint; connId: tConID; worker: uint): bool; override;

Handles "hello" and "bye" commands.

Public procedure AfterConstruction(); override;

Initializates server component.

Public procedure BeforeDestruction(); override;

Destroys internal objects.

Public procedure setClientOptions(clientIndex: int; options: uint = c_unaIPServer_co_default);

Sets new flags for a client.

Parameters
clientIndex
Index of client connection (from 0 to clientCount - 1).
Protected procedure addDeadSocket(connId: tConID);

Marks specified connection as "dead", so server will no longer attempt to communicate over it.

Parameters
connId
Connection to be marked as "dead".
Protected procedure doAcceptClient(connId: tConID; var accept: bool); virtual;

Fires onAcceptClient event handler (if assigned).

Protected procedure doClose(); override;

Closes the IP server.

Protected procedure doServerClientConnection(connId: tConID; isConnected: bool); virtual;

Fires onServerNewClient or onServerClientDisconnect event handlers (if assigned).

Protected procedure sendGoodbye(connId: tConID); override;

Sends goodbye command to all active clients.

Properties

Public property clientCount: unsigned read getClientCount;

Number of clients currently connected to server.

Public property clientOptions[clientIndex:int]: uint read getClientOptions write setClientOptions;

Client options.

@param clientIndex Index of client connection (from 0 to clientCount - 1).

Published property confMode: unaIpServerConferenceMode read f_confMode write f_confMode default uipscm_oneToMany;

Conference mode (not used).

Published property isFormatProvider default true;

IP server is usually a format provider - so this property value was changed to be true by default.

Published property maxClients: int read f_maxClients write setMaxClients default 1;

Max. number of clients allowed. Specify -1 for unlimited number.

Published property onAcceptClient: tunavclAcceptClient read f_onAcceptClient write f_onAcceptClient;

Fired when new client is connected. Leave accept true for client to be connected.

Published property onServerClientDisconnect: tunavclConnectEvent read f_onServerClientDisconnect write f_onServerClientDisconnect;

Triggers when client is disconnected from the server.

NOTE: VCL is NOT multi-threading safe, and you should avoid using VCL routines and classes in this event.

Published property onServerNewClient: tunavclConnectEvent read f_onServerNewClient write f_onServerNewClient;

Triggers when new client is connected to the server.

NOTE: VCL is NOT multi-threading safe, and you should avoid using VCL routines and classes in this event.

Public property packetStackThreadEnabled: bool read f_psEnabled write f_psEnabled;

Enable internal thread for packets' processing. Default is False.

Published property udpTimeout: tTimeout read f_udpTimeout write f_udpTimeout default c_defUdpConnTimeout;

Timeout for clients "connected" to UDP server. 0 means no timeout.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09