Hab mal was zusammengebaut.
Normalerweise müsste sich doch die Anwendung fehlerfrei beenden, wenn Das Socket auf dem Client geschlossen wurde, oder?
(Das Fenster dürfte praktisch nie angezeigt werden).
Kann das mal jemand so testen??
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net.Sockets;
using System.Net;
namespace TestAppNet
{
/// <summary>
/// Zusammenfassung für Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.Container components = null;
IPEndPoint m_oLocalEndPoint = null;
Socket m_oListenSocket = null;
Socket m_oTelnetSocket = null;
public Form1()
{
InitializeComponent();
m_oLocalEndPoint = new IPEndPoint(IPAddress.Parse("192.168.232.233"), 23);
m_oListenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
m_oListenSocket.Bind(m_oLocalEndPoint);
m_oListenSocket.Listen(2);
m_oTelnetSocket = m_oListenSocket.Accept();
while(m_oTelnetSocket.Connected)
{
m_oTelnetSocket.Send(new byte[1], 0, 0, 0);
}
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}