Koblížkáč
Koblížkáč
Explore posts from servers
CC#
Created by Koblížkáč on 5/12/2023 in #help
❔ Receive data from tcp client by one
Hello, the code is below, the problem is that the data is wrote only when the client disconnects, which is not correct
TcpListener listener = new(8080);
listener.Start();
while (true)
{
Debug.WriteLine("Waiting for client...");

// Accept an incoming client connection
TcpClient client = await listener.AcceptTcpClientAsync();
Debug.WriteLine("Client connected!");
NetworkStream stream = client.GetStream();
StreamReader reader = new StreamReader(stream, Encoding.UTF8);

// Read data from the client
while (client.Connected)
{
string? data = await reader.ReadLineAsync();
if (data == null) break;
Debug.WriteLine("Received data: " + data);
}
client.Close();
Debug.WriteLine("Client disconnected.");
}
TcpListener listener = new(8080);
listener.Start();
while (true)
{
Debug.WriteLine("Waiting for client...");

// Accept an incoming client connection
TcpClient client = await listener.AcceptTcpClientAsync();
Debug.WriteLine("Client connected!");
NetworkStream stream = client.GetStream();
StreamReader reader = new StreamReader(stream, Encoding.UTF8);

// Read data from the client
while (client.Connected)
{
string? data = await reader.ReadLineAsync();
if (data == null) break;
Debug.WriteLine("Received data: " + data);
}
client.Close();
Debug.WriteLine("Client disconnected.");
}
9 replies
CC#
Created by Koblížkáč on 5/7/2023 in #help
❔ How to allow TextBlock over window in UWP/WinUI
SO basically, my text get cut after the window ends, is there any way to prevent it? i need the entire text there
17 replies
CC#
Created by Koblížkáč on 1/23/2023 in #help
❔ IComponentConnector.Connect is explictly implemented more than once error
2 replies
CC#
Created by Koblížkáč on 11/18/2022 in #help
❔ Anchor TreeView in WinUI 3
How can I anchor TreeView to bottom like in WinForms where you have Anchor attribute?
2 replies