we have a code below in a client app that posts data to an HTTP listener runs on another program.
try
{
using (WebClient client = new WebClient())
{
client.Encoding = System.Text.Encoding.UTF8;
client.Credentials = new NetworkCredential(NotificationUser, NotificationPassword);
client.UploadString(NotificationUrl, msg); // Notification URL is IP base not DNS name.
}
}
catch (Exception ex){}
We are testing it in a high load environment and try to stress test the request/response latency. If I put both the programs on the same machine, I would get around 160 messages sent in one second from the posting app to the http listener app, but if I put the http listener app on different machine on the same network (a local network we create in house), that number goes down to about 5 messages/second.
Here are what we have tried so far:
- Ping to the 2nd machine shows it responses in less then 1ms and tracert shows it has only one hop. No firewall or proxy between the two machines.
- I used fiddler and StressStimulus to generate the heavy load of traffic to post to the listener app on another machine and I got (around 160 messages/second). In my opinion this rules out network latency or if the listener app is the problem.
- I tried to use UploadStringAsync instead of UploadString in the posting appand that did not make much different.
- No antivirus ect ...
The weird thing is this same code works normal if the listener app is on the same machine. Does anyone know that HTTP post has any restriction or something I overlook?