Description | Hierarchy | Fields | Methods | Properties |
type unavclIPServer = class(unavclInOutIpPipe)
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.
function getClientConnId(clientIndex: int): tConID; |
|
function getClientOptions(clientIndex: int): uint; |
|
function doSendPacket(connId: tConID; cmd: uint; out asynch: bool; data: pointer = nil; len: uint = 0; timeout: tTimeout = 82): tunaSendResult; override; |
|
function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override; |
|
function handleSocketEvent(event: unaSocketEvent; id, connId: tConID; data: pointer; len: uint): bool; override; |
|
function initSocksThread(): tConID; override; |
|
function onNewPacket(cmd: uint; data: pointer; len: uint; connId: tConID; worker: uint): bool; override; |
|
procedure AfterConstruction(); override; |
|
procedure BeforeDestruction(); override; |
|
procedure setClientOptions(clientIndex: int; options: uint = c_unaIPServer_co_default); |
|
procedure addDeadSocket(connId: tConID); |
|
procedure doAcceptClient(connId: tConID; var accept: bool); virtual; |
|
procedure doClose(); override; |
|
procedure doServerClientConnection(connId: tConID; isConnected: bool); virtual; |
|
procedure sendGoodbye(connId: tConID); override; |
property clientCount: unsigned read getClientCount; |
|
property clientOptions[clientIndex:int]: uint read getClientOptions write setClientOptions; |
|
property confMode: unaIpServerConferenceMode read f_confMode write f_confMode default uipscm_oneToMany; |
|
property isFormatProvider default true; |
|
property maxClients: int read f_maxClients write setMaxClients default 1; |
|
property onAcceptClient: tunavclAcceptClient read f_onAcceptClient write f_onAcceptClient; |
|
property onServerClientDisconnect: tunavclConnectEvent read f_onServerClientDisconnect write f_onServerClientDisconnect; |
|
property onServerNewClient: tunavclConnectEvent read f_onServerNewClient write f_onServerNewClient; |
|
property packetStackThreadEnabled: bool read f_psEnabled write f_psEnabled; |
|
property udpTimeout: tTimeout read f_udpTimeout write f_udpTimeout default c_defUdpConnTimeout; |
function getClientConnId(clientIndex: int): tConID; |
|
Returns connId for client connection with given index. Parameters
|
function getClientOptions(clientIndex: int): uint; |
|
Returns flags assigned for a client. Parameters
|
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. |
function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override; |
|
Writes data into the TCP/IP stream to be sent to client(s). |
function handleSocketEvent(event: unaSocketEvent; id, connId: tConID; data: pointer; len: uint): bool; override; |
|
Handles specific events reveived from server component. |
function initSocksThread(): tConID; override; |
|
Initializates sockets thread to be used with server. |
function onNewPacket(cmd: uint; data: pointer; len: uint; connId: tConID; worker: uint): bool; override; |
|
Handles "hello" and "bye" commands. |
procedure AfterConstruction(); override; |
|
Initializates server component. |
procedure BeforeDestruction(); override; |
|
Destroys internal objects. |
procedure setClientOptions(clientIndex: int; options: uint = c_unaIPServer_co_default); |
|
Sets new flags for a client. Parameters
|
procedure addDeadSocket(connId: tConID); |
|
Marks specified connection as "dead", so server will no longer attempt to communicate over it. Parameters
|
procedure doAcceptClient(connId: tConID; var accept: bool); virtual; |
|
Fires onAcceptClient event handler (if assigned). |
procedure doClose(); override; |
|
Closes the IP server. |
procedure doServerClientConnection(connId: tConID; isConnected: bool); virtual; |
|
Fires onServerNewClient or onServerClientDisconnect event handlers (if assigned). |
procedure sendGoodbye(connId: tConID); override; |
|
Sends goodbye command to all active clients. |
property clientCount: unsigned read getClientCount; |
|
Number of clients currently connected to server. |
property clientOptions[clientIndex:int]: uint read getClientOptions write setClientOptions; |
|
Client options. @param clientIndex Index of client connection (from 0 to clientCount - 1). |
property confMode: unaIpServerConferenceMode read f_confMode write f_confMode default uipscm_oneToMany; |
|
Conference mode (not used). |
property isFormatProvider default true; |
|
IP server is usually a format provider - so this property value was changed to be true by default. |
property maxClients: int read f_maxClients write setMaxClients default 1; |
|
Max. number of clients allowed. Specify -1 for unlimited number. |
property onAcceptClient: tunavclAcceptClient read f_onAcceptClient write f_onAcceptClient; |
|
Fired when new client is connected. Leave accept true for client to be connected. |
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. |
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. |
property packetStackThreadEnabled: bool read f_psEnabled write f_psEnabled; |
|
Enable internal thread for packets' processing. Default is False. |
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