-
-
Save profesor79/88caa975909fd19cd624d9e15a247138 to your computer and use it in GitHub Desktop.
A tcp load for stream testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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