![]() |
Disconnect merken?
Moin, ich habe folgendes in C# geschriben:
Code:
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....
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")); } } } |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:05 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz