using System;
using System.IO;
using System.Text;
using System.Net;
using System.Net.Sockets;

using System.Security.Cryptography;

public class Server
{
    public static void Main(string[] args)
    {
        //Server sendet Daten an den Client
        Console.WriteLine("Server");

        TcpClient serverSocket = new TcpClient("localhost", 9000);
        UnicodeEncoding ue = new UnicodeEncoding();
        byte[] writeBytes = ue.GetBytes("ABCDE"); //10 Bytes

        NetworkStream ns = serverSocket.GetStream();

        byte[] key = Convert.FromBase64String("HvUPIbS3UM4HSrzGORLmTFAf359ay+mI");
        byte[] iv = Convert.FromBase64String("RC0TQxaU5f8=");
        TripleDES tdes = TripleDES.Create();

        CryptoStream cs =
           new CryptoStream(ns, tdes.CreateEncryptor(key, iv), CryptoStreamMode.Write);

        cs.Write(writeBytes, 0, 10);
        cs.Close(); //nicht vergessen !!!

        Console.ReadLine();
    }

}
