Verwendung von StreamWriter im Sender
This commit is contained in:
@@ -5,22 +5,21 @@ using System.Text;
|
|||||||
|
|
||||||
public class Sender
|
public class Sender
|
||||||
{
|
{
|
||||||
private NetworkStream NStream;
|
private StreamWriter Writer;
|
||||||
private Terminal Term;
|
private Terminal Term;
|
||||||
|
|
||||||
public Sender (NetworkStream stream, Terminal terminal)
|
public Sender (NetworkStream stream, Terminal terminal)
|
||||||
{
|
{
|
||||||
this.Term = terminal;
|
this.Term = terminal;
|
||||||
this.NStream = stream;
|
this.Writer = new StreamWriter(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Send ()
|
public void Send ()
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
String line = Term.ReadLine ();
|
String line = Term.ReadLine ();
|
||||||
line += "\n";
|
Writer.WriteLine(line);
|
||||||
byte[] bytes = Encoding.UTF8.GetBytes(line);
|
Writer.Flush();
|
||||||
NStream.Write (bytes, 0, bytes.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user