Note that there are some explanatory texts on larger screens.

plurals
  1. POTcpClient isn't available in Blend
    text
    copied!<p>I'm writing a blend application that is supposed to use a TCPClient connection to my server, but on compile time I get <code>Type or namespace TcpClient does not exist...</code>, even though I know I'm including the right library (as this code is almost copied straight from my C# windows form client).</p> <p>I'll probably write it over a normal Socket, but if anyone knows why this doesn't show or how can I make it, it would make my life easier.</p> <p>Thanks ;)</p> <pre><code>using System; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Net.Sockets; using System.IO; using System.Net; namespace CCClient { public partial class CCClient { public CCConnection Connection = null; public CCClient() { if ((this.Connection = new CCConnection(IPAddress.Parse("-_-"), 9001)) == null) { throw new Exception("Could not instantiate Client Connection to Server."); } else { this.Connection.WriteLine("Role: client"); this.Connection.WriteLine("Stream: test"); } } } public class CCConnection { public TcpClient HostConnection = null; public StreamWriter HostWriter = null; public StreamReader HostReader = null; public CCConnection(IPAddress Host, int Port) { if (Host == null || Port == 0) { throw new Exception("Could not instantiation CCConnection. Host or Port are invalid."); } else { try { this.HostConnection = new TcpClient(); this.HostConnection.Connect(Host, Port); this.HostWriter = new StreamWriter(this.HostConnection.GetStream()); this.HostReader = new StreamReader(this.HostConnection.GetStream()); } catch (Exception e) { throw new Exception("Could not instantiate CCConnection. Exception encountered.\n" + e.Message); } } } public void WriteLine( String Argument ) { if (!String.IsNullOrWhiteSpace(Argument)) { this.HostWriter.WriteLine(Argument); this.HostWriter.Flush(); return; } } public String ReadLine() { return this.HostReader.ReadLine(); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload