BlackBerry Dynamics for Xamarin Forms  7.0.0.22
Runtime library for Xamarin Forms applications
BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket Interface Reference

TCP socket, supporting SSL/TLS and communication across the firewall. More...

Public Member Functions

void ConnectAsync ()
 Connects the socket. More...
 
void DisconnectAsync ()
 Terminates the socket connection. More...
 
Task DisableHostVerificationAsync ()
 Switches off host name verification, when making an SSL/TLS connection. Host name verification is an SSL/TLS security option. More...
 
Task DisablePeerVerificationAsync ()
 Switches off certificate authenticity verification, when making an SSL/TLS connection. Authenticity verification is an SSL/TLS security option. More...
 
Task WriteAsync (byte[] data)
 Sends data to socket. More...
 
Task< byte[]> ReadAllAsync ()
 Reads all bytes available in the socket. More...
 
Task< byte[]> ReadAsync ()
 Reads some number of bytes available in the socket. More...
 

Properties

string Url [get]
 String containing the address of the server. Can be either an Internet Protocol address (IP address, for example "192.168.1.10"), or a fully qualified domain name (for example "www.example.com"). More...
 
int Port [get]
 Number of the server port to which the socket will connect. More...
 
int BufferSize [get]
 The size of buffer into which the data is read. More...
 
bool IsSecure [get]
 Informs if SSL/TLS security is used. More...
 
bool IsConnected [get]
 Informs about connection state of the socket. More...
 
bool IsClosed [get]
 Returns the closed state of the socket. More...
 
bool IsDataAvailable [get]
 Informs if data has been received from the network and is available to be read. More...
 

Events

EventHandler< EventArgs > Connected
 Socket connected event. More...
 
EventHandler< EventArgs > Disconnected
 Socket disconnected event. More...
 
EventHandler< EventArgs > DataReceived
 Socket data received event. More...
 
EventHandler< BBDSocketErrorEventArgsErrorOccurred
 Socket error event. More...
 

Detailed Description

TCP socket, supporting SSL/TLS and communication across the firewall.

The BlackBerry Dynamics socket is for bi-directional data communication between the mobile application on the device and an application server. The application server can be on the Internet, or behind the enterprise firewall. Secure Socket Layer and Transport Layer Security (SSL/TLS) are supported.

The functions in this class cannot be called until BlackBerry Dynamics authorization processing is complete.

BlackBerry Dynamics secure communication does not use the proxy specified in the device's native settings, if applicable.

For more information go to BlackBerry Dynamics for iOS and Android.

Member Function Documentation

void BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.ConnectAsync ( )

Connects the socket.

The connection attempt is asynchronous. If the attempt succeeds, the Connected event is raised.

Task BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.DisableHostVerificationAsync ( )

Switches off host name verification, when making an SSL/TLS connection. Host name verification is an SSL/TLS security option.

This function must be called before connect.

Switching off host name verification doesn't switch off authenticity verification.

Returns
Task.
Task BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.DisablePeerVerificationAsync ( )

Switches off certificate authenticity verification, when making an SSL/TLS connection. Authenticity verification is an SSL/TLS security option.

This function must be called before connect.

Switching off authenticity verification implicitly also switches off host name verification.

Returns
Task.
void BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.DisconnectAsync ( )

Terminates the socket connection.

Disconnection is asynchronous. When disconnection completes, the Disconnected event is raised.

Task<byte[]> BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.ReadAllAsync ( )

Reads all bytes available in the socket.

Returns
Array of bytes or null on error.
Task<byte[]> BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.ReadAsync ( )

Reads some number of bytes available in the socket.

The number of bytes read is, at most, equal to the length of BufferSize.

Returns
Array of bytes or null on error.
Task BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.WriteAsync ( byte[]  data)

Sends data to socket.

Parameters
data
Returns
Task.

Property Documentation

int BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.BufferSize
get

The size of buffer into which the data is read.

bool BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.IsClosed
get

Returns the closed state of the socket.

bool BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.IsConnected
get

Informs about connection state of the socket.

Closing the socket doesn't clear connection state (this property will return true if the socket was connected).

bool BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.IsDataAvailable
get

Informs if data has been received from the network and is available to be read.

bool BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.IsSecure
get

Informs if SSL/TLS security is used.

int BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.Port
get

Number of the server port to which the socket will connect.

string BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.Url
get

String containing the address of the server. Can be either an Internet Protocol address (IP address, for example "192.168.1.10"), or a fully qualified domain name (for example "www.example.com").

Event Documentation

EventHandler<EventArgs> BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.Connected

Socket connected event.

This event is raised when the corresponding socket opens for communication with the remote server.

Raising of this event also notifies the application on the device that data can be written to the socket.

EventHandler<EventArgs> BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.DataReceived

Socket data received event.

This event is raised when data has been received from the remote server, and is ready to read.

The received data will be available in the corresponding socket and can be accessed using the ReadAllAsync or ReadAsync methods.

EventHandler<EventArgs> BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.Disconnected

Socket disconnected event.

This event is raised when the corresponding socket is closed. This means closed by the remote end, or by the client end.

Raising this event notifies the application on the device that:

  • the socket cannot now be used for writing.
  • No more data will be received on the socket.
EventHandler<BBDSocketErrorEventArgs> BBDXamarinForms.Common.Interfaces.Networking.Sockets.IBBDSocket.ErrorOccurred

Socket error event.

This event is raised when a socket error occurs on the corresponding socket.