C # ssl stream does not stop buffering before sending

I am trying to use C # to connect through an ssl socket to a server and send XML data back and forth. It seems that the data will not be sent until it reaches a certain packet size of 1000 bytes, on which all packets are simply broken one on top of the other. Is there a way to force the ssl library to send packets as they are sent?

I use SslStream and StreamWriter to send data, and I already tried to make the packet size smaller and set NoDelay to true to no avail. Is there something I'm missing?

sslStream = new SslStream(sslClient.GetStream(), false, new RemoteCertificateValidationCallback(CertificateValidationCallback));
sslStream.AuthenticateAsClient(appSettings.CBPASServer);
showSslInfo(appSettings.CBPASServer, sslStream, true);
streamWriter = new StreamWriter(sslStream);

...

sslStream.Write(xml);
sslStream.Flush();
+3
source share
1 answer

, StreamWriter, . AutoFlush = true.

+1

Source: https://habr.com/ru/post/1716223/


All Articles