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
IDisposable
Namespace: VoltRpc.Communication
Assembly: VoltRpc.dll
Syntax
public abstract class Client : IDisposable

Constructors

| Edit this page View Source

Client(int)

Creates a new Client instance

Declaration
protected Client(int bufferSize = 8000)
Parameters
TypeNameDescription
intbufferSize

The initial size of the buffers

Exceptions
TypeCondition
ArgumentOutOfRangeException

Will throw if the buffer size is less then 16

Fields

| Edit this page View Source

DefaultBufferSize

The default size of the buffers

Declaration
public const int DefaultBufferSize = 8000
Field Value
TypeDescription
int

Properties

| Edit this page View Source

HasDisposed

Has this object been disposed

Declaration
public bool HasDisposed { get; }
Property Value
TypeDescription
bool
| Edit this page View Source

IsConnected

Is the Client connected

Declaration
public bool IsConnected { get; }
Property Value
TypeDescription
bool
| Edit this page View Source

TypeReaderWriterManager

Declaration
public TypeReaderWriterManager TypeReaderWriterManager { get; }
Property Value
TypeDescription
TypeReaderWriterManager

Methods

| Edit this page View Source

AddService(Type)

Tells the Client what interfaces you might be using

Declaration
public void AddService(Type interfaceType)
Parameters
TypeNameDescription
TypeinterfaceType
Exceptions
TypeCondition
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

| Edit this page View Source

AddService<T>()

Tells the Client what interfaces you might be using

Declaration
public void AddService<T>() where T : class
Type Parameters
NameDescription
T

The same interface that you are using on the server

Exceptions
TypeCondition
NullReferenceException

Thrown if T's FullName is null

ArgumentOutOfRangeException

Thrown if T is not an interface, or has already been added as a service.

| Edit this page View Source

CheckDispose()

Checks the disposal state on this object

Declaration
protected void CheckDispose()
Exceptions
TypeCondition
ObjectDisposedException
| Edit this page View Source

Connect()

Connects the Client to a host

Declaration
public abstract void Connect()
| Edit this page View Source

Dispose()

Destroys the Client instance

Declaration
public virtual void Dispose()
| Edit this page View Source

~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()
| Edit this page View Source

Initialize(Stream, Stream)

Initialize streams

Declaration
protected void Initialize(Stream readStream, Stream writeStream)
Parameters
TypeNameDescription
StreamreadStream

The Stream to read from

StreamwriteStream

The Stream to write to

Exceptions
TypeCondition
ArgumentNullException

Thrown if either provided stream is null

ArgumentOutOfRangeException

Thrown if we can't read or write to the respected streams

| Edit this page View Source

Initialize(BufferedReader, BufferedWriter)

Initialize streams

Declaration
protected void Initialize(BufferedReader bufferedRead, BufferedWriter bufferedWrite)
Parameters
TypeNameDescription
BufferedReaderbufferedRead

The BufferedReader that will be read from

BufferedWriterbufferedWrite

The BufferedWriter that will be written to

Exceptions
TypeCondition
ArgumentNullException

Thrown if either provided buffers is null

| Edit this page View Source

SetProtocolVersion(object?)

Sets what protocol version to use.

Set value to null to reset back to none.

Declaration
public void SetProtocolVersion(object? value)
Parameters
TypeNameDescription
objectvalue

Value can be any object you want, as long as the TypeReaderWriterManager has a TypeReadWriter<T> for it.

Exceptions
TypeCondition
AlreadyConnectedException

Thrown if the Client is already connected to a Host

NoTypeReaderWriterException

Thrown if the TypeReaderWriterManager doesn't have a TypeReadWriter<T> for the value Type.

Implements

IDisposable