Class ServerBase
Definition
- Namespace:
- Tizen.Applications.Cion
- Assembly:
- Tizen.Applications.Cion.dll
An abstract class to represent cion server.
C#
Copy
public abstract class ServerBase : IDisposable
- Inheritance
-
objectServer
Base
- Implements
-
System.
IDisposable
Constructors
Declaration
C#
Copy
public ServerBase(string serviceName, string displayName, SecurityInfo security)
Parameters
Type | Name | Description |
---|---|---|
string | serviceName | The name of service. |
string | displayName | The display name of service. |
Security |
security | The security configuration. |
Remarks
The maximum length of service name is 512.
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the given service name is too long. |
System. |
Thrown when there is not enough memory to continue the execution of the method. |
Declaration
C#
Copy
public ServerBase(string serviceName, string displayName)
Parameters
Type | Name | Description |
---|---|---|
string | serviceName | The name of service. |
string | displayName | The display name of service. |
Remarks
The maximum length of service name is 512.
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the given service name is too long. |
System. |
Thrown when there is not enough memory to continue the execution of the method. |
Properties
Declaration
C#
Copy
public string DisplayName { get; set; }
Property Value
Type | Description |
---|---|
string |
Declaration
C#
Copy
public string ServiceName { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Declaration
C#
Copy
public void Accept(PeerInfo peerInfo)
Parameters
Type | Name | Description |
---|---|---|
Peer |
peerInfo | The peer to accept the connection request. |
Declaration
C#
Copy
public void Disconnect(PeerInfo peerInfo)
Parameters
Type | Name | Description |
---|---|---|
Peer |
peerInfo | The peer to disconnect. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the given peer info is invalid. |
Declaration
C#
Copy
public void Dispose()
Dispose(bool)
Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | If true, disposes any disposable objects. If false, does not dispose disposable objects. |
Declaration
C#
Copy
public IEnumerable<PeerInfo> GetConnectedPeerList()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><Peer |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when there is not enough memory to continue the execution of the method. |
Declaration
C#
Copy
public void Listen()
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the listen operation is already in progress. |
System. |
Thrown when an application does not have the privilege to access this method. |
OnConnectionRequest(PeerInfo)
The callback invoked when connection requested from the cion client.
Declaration
C#
Copy
protected abstract void OnConnectionRequest(PeerInfo peerInfo)
Parameters
Type | Name | Description |
---|---|---|
Peer |
peerInfo | The peer info of the cion client. |
OnConnectionResult(PeerInfo, ConnectionResult)
The result callback of connection request.
Declaration
C#
Copy
protected abstract void OnConnectionResult(PeerInfo peerInfo, ConnectionResult result)
Parameters
Type | Name | Description |
---|---|---|
Peer |
peerInfo | The peer info of the cion client. |
Connection |
result | The result of the connection. |
Declaration
C#
Copy
protected abstract byte[] OnDataReceived(byte[] data, PeerInfo peerInfo)
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | The received data. |
Peer |
peerInfo | The peer info of the cion client. |
Returns
Type | Description |
---|---|
byte[] |
Declaration
C#
Copy
protected abstract void OnDisconnected(PeerInfo peerInfo)
Parameters
Type | Name | Description |
---|---|---|
Peer |
peerInfo | The peer info of the cion client. |
OnPayloadReceived(Payload, PeerInfo, PayloadTransferStatus)
The callback invoked when received payload.
Declaration
C#
Copy
protected abstract void OnPayloadReceived(Payload data, PeerInfo peerInfo, PayloadTransferStatus status)
Parameters
Type | Name | Description |
---|---|---|
Payload | data | The received data. |
Peer |
peerInfo | The peer info of the cion client. |
Payload |
status | The status of payload transfer. |
Declaration
C#
Copy
public void Reject(PeerInfo peerInfo, string reason)
Parameters
Type | Name | Description |
---|---|---|
Peer |
peerInfo | The peer to reject the connection request. |
string | reason | The reason why reject the connection request. |
Declaration
C#
Copy
public Task<PayloadAsyncResult> SendPayloadAsync(Payload payload, PeerInfo peerInfo)
Parameters
Type | Name | Description |
---|---|---|
Payload | payload | The payload to send. |
Peer |
peerInfo | The peer to send payload. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><Payload |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the payload is not valid. |
System. |
Thrown when there is no such connected cion client or failed to send payload. |
Declaration
C#
Copy
public void SendPayloadAsync(Payload payload)
Parameters
Type | Name | Description |
---|---|---|
Payload | payload | The payload to send. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the payload is not valid. |
System. |
Thrown when failed to send payload. |
Declaration
C#
Copy
public void SetOndemandLaunchEnabled(bool enable)
Parameters
Type | Name | Description |
---|---|---|
bool | enable | Whether ondemand launch is enabled or not. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when an application does not have the privilege to access this method. |
Declaration
C#
Copy
public void Stop()
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the server is not listening. |