tags:

views:

553

answers:

1

I am trying to use C# to connect over a ssl socket to a server and send xml data back and forth. It seems that data won't be sent till it has reached a certain packet size 1000 bytes, upon which all the packets are just smashed on top of each other. Is there a way to force ssl library to send out packets as I send them?

I am using SslStream and StreamWriter to send the data, and i have already tried making packet size smaller and setting NoDelay to true to no avail. Is there just something I am 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();
+1  A: 

My guess is that it's your StreamWriter that is chunking your data. Try setting AutoFlush = true.

David
not a bad guess but I would think the immediate following flush i have would do the same thing. Also I did try turning on autoflush with no luck. Thanks for advice though
mog