static void Main(string[] args) { //Connect("127.0.0.1", "String message"); ClientClass clientClass = new ClientClass("127.0.0.1", 13000); clientClass.Connect(); clientClass.SendMessage("Hello there!"); //clientClass.SendMessage("Auth: Me"); }
static void Main(string[] args) { // Connect("127.0.0.1", "String message"); ClientClass client = new ClientClass("127.0.0.1", 13000); client.Connect(); client.OnMessageReceived += (message) => { Console.WriteLine($"Message received: {message}"); }; client.Connect(); client.SendMessage("message to server"); client.Disconnect(); }
static void Main(string[] args) { //Connect("127.0.0.1", "String message"); ClientClass client = new ClientClass("127.0.0.1", 13000); client.Connect(new TcpClient()); client.OnMessageRecevd += (message) => {}; client.SendMessage("Hello world!"); Console.ReadLine(); client.Disconnect(); Console.ReadLine(); }
static void Main(string[] args) { ClientClass client = new ClientClass(); client.Geantwortet += Client_Geantwortet; client.Connect("localhost", 15321); Thread t = new Thread(new ThreadStart(() => { Thread.Sleep(1000); while (client.IsConnected) { client.Write(TCP_Protocoll.HeaderData.Broadcast, "Hello From " + (new Random()).Next(0, 100).ToString()); Thread.Sleep(1000); } })); t.Start(); Console.ReadKey(); }