I am having a bit of trouble getting the sslstream to work with sending multiple message after each other.
The way i call my client to send data
client.Send(objectOne);
client.Send(objectTwo);
the error message i receive is:
The BeginWrite method cannot be called when another write operation is pending
i have tried different solutions to get this to work, but none gets the it to work.
The base function uses await, and that function gets called
// client send
public void Send(object data)
{
byte[] sendData = SerializationHelper.Serialize(data);
base.Send(sendData);
}
// base send
protected async void Send(byte[] data)
{
await stream.WriteAsync(data, 0, data.Length);
}
Base function returns a task, and uses await in the client method
// client send
public async void Send(object data)
{
byte[] sendData = SerializationHelper.Serialize(data);
await base.Send(sendData);
}
// base send
protected async Task Send(byte[] data)
{
await stream.WriteAsync(data, 0, data.Length);
}
i still receive the same error, anyone have any idea to get this to work?