Skip to content

Instantly share code, notes, and snippets.

@profesor79
Created February 27, 2023 18:26
Show Gist options
  • Save profesor79/88caa975909fd19cd624d9e15a247138 to your computer and use it in GitHub Desktop.
Save profesor79/88caa975909fd19cd624d9e15a247138 to your computer and use it in GitHub Desktop.
A tcp load for stream testing
void Main()
{
Connect();
}
static void Connect()
{
var client = new TcpClient("localhost", 8888);
var message = @"make it large long big and fat, so the buffer will be filled fast
";
var data = System.Text.Encoding.ASCII.GetBytes(message);
NetworkStream stream = client.GetStream();
var counter = 1;
while (true)
{
// Send the message to the connected TcpServer.
stream.Write(data, 0, data.Length);
Console.WriteLine($"time:{DateTime.Now},\tcounter: { counter++} ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment