udp - Simulate packet loss in C program language -


i have udp server/client code written in c , want simulate packet loss because packet loss on wireless network high , can not perform tests switched ethernet. example want have 20 % packet loss, how can in c ?

thx

i'm not sure want simulate network interuptions in application, test show simulation works. have simulate loss of packets outside of application.

you can add iptables rules doing :

# randomly dropping 20% of incoming packets: iptables -a input -m statistic --mode random --probability 0.2 -j drop  # , dropping 20% of outgoing packets: iptables -a output -m statistic --mode random --probability 0.2 -j drop 

http://code.nomad-labs.com/2010/03/11/simulating-dropped-packets-aka-crappy-internets-with-iptables/


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -