开发者

C# udpclient.send to fake ip too slow to complete

开发者 https://www.devze.com 2023-01-28 15:37 出处:网络
when i udpclient.send to an fake/unknown ip, the process took a long time to开发者_StackOverflow中文版 complete(about 2 seconds per call. for 1000 calls it took about 2000 seconds). if i udpclient.sen

when i udpclient.send to an fake/unknown ip, the process took a long time to开发者_StackOverflow中文版 complete(about 2 seconds per call. for 1000 calls it took about 2000 seconds). if i udpclient.send to a known ip, sending 1000 packets took less than 2 seconds.

i was using send for development and this kind of things makes development process took a long time. is there a way to prevent this slowdown? fyi, i did put ip address(not hostname to prevent dns resolve), i did try use udpclient.connect but the problem still persist.

thanks.


As you have guessed by now, this is DNS problem.

In your local machine, you could write in /etc/hosts (assuming you are developing on Linux), an entry like:

192.168.1.20    target-develop

then the resolution of name "target-develop" will take only a moment.

EDIT

If you send packets to unknown/fake IP and it takes long time, it could be a firewall's configuration problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号