title: Connect Flutter to SslStrem in C#
body: <p>I have this c# server using SslStream:</p>
  <pre><code>TcpListener Server = new TcpListener(IPAddress.Any, 13001);
  Server.Start();
  var client = Server.AcceptTcpClient();
  
  var stream = client.GetStream();
  SslStream sslStream = new SslStream(stream, false);
  var certificate = new X509Certificate2(&quot;server.pfx&quot;, &quot;password&quot;);
  sslStream.AuthenticateAsServer(certificate, false, System.Security.Authentication.SslProtocols.Tls, false);
  
  string text= string.empty;
  
  do
  {
  byte[] buffer = new byte[client.ReceiveBufferSize];
  int bytesRead = sslStream.Read(buffer, 0, client.ReceiveBufferSize);
  Input += (Encoding.ASCII.GetString(buffer, 0, bytesRead));
  } while (!Input.EndsWith(&quot;&lt;EOF&gt;&quot;));
  
  string Return = &quot;Sesrver's answer&quot; + &quot;&lt;EOF&gt;&quot;;
  
  sslStream.Write(Encoding.UTF8.GetBytes(Return), 0, Return.Length);
  </code></pre>
  <p>Before using SslStream I used to connect this flutter client:</p>
  <pre><code>String _textBuilder = &quot;&quot;;
    Socket socket = await Socket.connect(ipAddress, port, timeout: const Duration(seconds: 8));
    socket.listen((List&lt;int&gt; event) {
        _textBuilder += utf8.decode(event);
    });
    socket.add(utf8.encode(&quot;Some request text&quot; + &quot;&lt;EOF&gt;&quot;));
    while (!_textBuilder.endsWith(&quot;&lt;EOF&gt;&quot;))
    {
      await Future.delayed(const Duration(milliseconds: 50));
    }
  </code></pre>
  <p>Everything worked fine but now I don't know how to connect flutter to server. Any help please?</p>