Class Client
The Client is what is used to send messages to a Host
This base Client has no implementation of actually connecting, a "communication layer" needs to be used, such as the TCPClient communication layer
In most normal cases, you will only have to use the generated proxy layer to interact with the Host
Implements
Inherited Members
Namespace: VoltRpc.Communication
Assembly: VoltRpc.dll
Syntax
public abstract class Client : IDisposable
Constructors
| Edit this page View SourceClient(int)
Creates a new Client instance
Declaration
protected Client(int bufferSize = 8000)
Parameters
Type | Name | Description |
---|---|---|
int | bufferSize | The initial size of the buffers |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Will throw if the buffer size is less then 16 |
Fields
| Edit this page View SourceDefaultBufferSize
The default size of the buffers
Declaration
public const int DefaultBufferSize = 8000
Field Value
Type | Description |
---|---|
int |
Properties
| Edit this page View SourceHasDisposed
Has this object been disposed
Declaration
public bool HasDisposed { get; }
Property Value
Type | Description |
---|---|
bool |
IsConnected
Is the Client connected
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
bool |
TypeReaderWriterManager
The TypeReaderWriterManager for Client
Declaration
public TypeReaderWriterManager TypeReaderWriterManager { get; }
Property Value
Type | Description |
---|---|
TypeReaderWriterManager |
Methods
| Edit this page View SourceAddService(Type)
Tells the Client what interfaces you might be using
Declaration
public void AddService(Type interfaceType)
Parameters
Type | Name | Description |
---|---|---|
Type | interfaceType |
Exceptions
Type | Condition |
---|---|
NullReferenceException | Thrown if interfaceType's FullName is null |
ArgumentOutOfRangeException | Thrown if interfaceType is not an interface, or has already been added as a service. |
AlreadyConnectedException | Thrown if we are already connected |
AddService<T>()
Tells the Client what interfaces you might be using
Declaration
public void AddService<T>() where T : class
Type Parameters
Name | Description |
---|---|
T | The same interface that you are using on the server |
Exceptions
Type | Condition |
---|---|
NullReferenceException | Thrown if T's FullName is null |
ArgumentOutOfRangeException | Thrown if T is not an interface, or has already been added as a service. |
CheckDispose()
Checks the disposal state on this object
Declaration
protected void CheckDispose()
Exceptions
Type | Condition |
---|---|
ObjectDisposedException |
Connect()
Connects the Client to a host
Declaration
public abstract void Connect()
Dispose()
Destroys the Client instance
Declaration
public virtual void Dispose()
~Client()
Deconstructor for Client.
Tells the server that we have disconnected and releases resources if it hasn't been done by Dispose() already.
Declaration
protected ~Client()
Initialize(Stream, Stream)
Initialize streams
Declaration
protected void Initialize(Stream readStream, Stream writeStream)
Parameters
Type | Name | Description |
---|---|---|
Stream | readStream | The Stream to read from |
Stream | writeStream | The Stream to write to |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if either provided stream is null |
ArgumentOutOfRangeException | Thrown if we can't read or write to the respected streams |
Initialize(BufferedReader, BufferedWriter)
Initialize streams
Declaration
protected void Initialize(BufferedReader bufferedRead, BufferedWriter bufferedWrite)
Parameters
Type | Name | Description |
---|---|---|
BufferedReader | bufferedRead | The BufferedReader that will be read from |
BufferedWriter | bufferedWrite | The BufferedWriter that will be written to |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if either provided buffers is null |
SetProtocolVersion(object?)
Sets what protocol version to use.
Set value to null to reset back to none.
Declaration
public void SetProtocolVersion(object? value)
Parameters
Type | Name | Description |
---|---|---|
object | value | Value can be any object you want, as long as the TypeReaderWriterManager has a TypeReadWriter<T> for it. |
Exceptions
Type | Condition |
---|---|
AlreadyConnectedException | |
NoTypeReaderWriterException | Thrown if the TypeReaderWriterManager doesn't have a TypeReadWriter<T> for the value Type. |