public void Action()
            {
                string data = null;

                byte[] bytes = null;

                int bytesRec;
                int i = 0;

                try
                {
                    bytes = new byte[1024];

                    bytesRec = _parent._workSocket.Receive(bytes);

                    int posStart = SearchStartByte(bytes);
                    int posEnd   = SearchEndByte(bytes);

                    data += Encoding.ASCII.GetString(bytes, posStart + 1, (posEnd - posStart + 1));

                    //MessageBox.Show(data);

                    _parent.ProcessCompleted(this, data);
                    _parent.SetState(_parent._readState);
                }
                catch (Exception e)
                {
                    //MessageBox.Show("Read failed: " + e.ToString());
                    _parent.SetState(_parent._closeState);
                }
                //a
            }
            public void Action()
            {
                switch (_parent._config.connectionTyp)
                {
                case ConnectionKind.Client:

                    string     ipAddress = _parent._config.ipServer;
                    IPAddress  address   = IPAddress.Parse(ipAddress);
                    IPEndPoint remoteEP  = new IPEndPoint(address, _parent._config.portClient);
                    try
                    {
                        //frage ob server da ist
                        // Connect to Remote EndPoint
                        _parent._workSocket.Connect(remoteEP);

                        _parent.SetState(_parent._readState);
                        //_parent._workSocket = new TcpClient(_parent._config.ipClient, _parent._config.portClient);
                        //private NetworkStream stream;
                        //stream = client.GetStream();
                        //_parent.SetState(_parent._readState);
                    }
                    catch (TimeoutException et)
                    {
                        //MessageBox.Show("Time Out Exception : {0}", et.ToString());
                        _parent.SetState(_parent._connectState);
                    }
                    catch (ArgumentNullException ane)
                    {
                        //MessageBox.Show("ArgumentNullException : {0}", ane.ToString());
                    }
                    catch (SocketException se)
                    {
                        //MessageBox.Show("SocketException, connection Client failed: {0}", se.ToString());
                    }
                    catch (Exception ex)
                    {
                        _parent.SetState(_parent._initState);
                        //MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    break;


                case ConnectionKind.Server:
                    try
                    {
                        //aktuell nicht benutzt


                        _parent.SetState(_parent._readState);
                    }
                    catch (TimeoutException e)
                    {
                        //MessageBox.Show("TimeOut by Listening" + e.Message);
                        _parent.SetState(_parent._closeState);
                    }

                    break;
                }
            }
            public void Action()
            {
                switch (_parent._config.connectionTyp)
                {
                case ConnectionKind.Client:
                    try
                    {
                        _parent._workSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)
                        {
                            ReceiveTimeout = 3000,
                            SendTimeout    = 3000,
                        };
                        _parent.SetState(_parent._connectState);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Init Client schlägt fehl" + e.Message);
                        _parent.SetState(_parent._initState);
                    }
                    break;

                case ConnectionKind.Server:
                    try
                    {
                        _parent._workSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)
                        {
                            SendTimeout    = 1000,
                            ReceiveTimeout = 1000
                        };
                        //Socket konfigurieren

                        string     ipAddress = _parent._config.ipServer;
                        IPAddress  address   = IPAddress.Parse(ipAddress);
                        IPEndPoint myEP      = new IPEndPoint(address, _parent._config.portServer);

                        this._parent._workSocket.Bind(myEP);
                        // We will listen 1 requests at a time
                        //geht iwie immer durch!!!!!!!!!!!
                        this._parent._workSocket.Listen(1);

                        this._parent._workSocket = this._parent._workSocket.Accept();
                        //MessageBox.Show("Connection accepted");

                        _parent.SetState(_parent._readState);
                    }
                    catch (TimeoutException e)
                    {
                        // MessageBox.Show("TimeOut by Listening Server" + e.Message);
                        _parent.SetState(_parent._closeState);
                    }
                    catch (Exception ex)
                    {
                        _parent.SetState(_parent._closeState);
                        //MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    break;
                }
            }
            public void Action()
            {
                switch (_parent._config.connectionTyp)
                {
                case ConnectionKind.Client:
                    try
                    {
                        // Release the socket.
                        _parent._workSocket.Shutdown(SocketShutdown.Both);
                        _parent._workSocket.Close();
                        _parent.SetState(_parent._initState);
                    }
                    catch (Exception e)
                    {
                        //Console.WriteLine(e.ToString());
                        _parent._workSocket.Close();
                        _parent.SetState(_parent._initState);
                    }
                    break;

                case ConnectionKind.Server:
                    try
                    {
                        // Release the socket.
                        _parent._workSocket.Shutdown(SocketShutdown.Both);
                        _parent._workSocket.Close();
                        _parent.SetState(_parent._initState);
                    }
                    catch (Exception e)
                    {
                        //MessageBox.Show(e.ToString());
                        _parent.SetState(_parent._initState);
                    }

                    break;
                }
            }