Meine Lösung für Aufgabenblatt 2
This commit is contained in:
26
dummyclient_manuel/Sender.cs
Normal file
26
dummyclient_manuel/Sender.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
public class Sender
|
||||
{
|
||||
private NetworkStream NStream;
|
||||
private Terminal Term;
|
||||
|
||||
public Sender (NetworkStream stream, Terminal terminal)
|
||||
{
|
||||
this.Term = terminal;
|
||||
this.NStream = stream;
|
||||
}
|
||||
|
||||
public void Send ()
|
||||
{
|
||||
while (true) {
|
||||
String line = Term.ReadLine ();
|
||||
line += "\n";
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(line);
|
||||
NStream.Write (bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user