Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Disconnect merken? (https://www.delphipraxis.net/64893-disconnect-merken.html)

Pseudemys Nelsoni 9. Mär 2006 16:38


Disconnect merken?
 
Moin, ich habe folgendes in C# geschriben:

Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;

namespace iSM
{
    class Program
    {
        static void Main(string[] args)
        {
            bool bClose = false;
            TcpClient tcpClient = new TcpClient();

            tcpClient.Connect("irc.ham.de.euirc.net", 6667);

             SendText(ref tcpClient, "USER bla bla :blubb");
             SendText(ref tcpClient, "NICK irgendwas");

             while (!bClose)
             {
                 string bla = Console.ReadLine();
                 switch (bla.Split(' ')[1])
                 {
                    case "RAW":
                         string prm = bla.Substring(bla.IndexOf(' '), bla.Length);
                         SendText(ref tcpClient, prm);
                         break;
                 }
            }
        }

        static void SendText(ref TcpClient tcpClient, string Text)
        {
            if (tcpClient != null)
                tcpClient.Client.Send(System.Text.ASCIIEncoding.Default.GetBytes(Text+"\r\n"));
        }

    }
}
So, ich verbinde also mit dem Server und sende ihm abundzu Text.... nur wie bekomme ich jetzt ein Disconnect mit? ich bin das mit delphi im OI "OnDisconnect" gewohnt...aber hier gibts ja keine Events in einer Konsolenanwendung....


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:14 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz