Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Added support for multiple connections and chunk size for send_udp example. | eff367aa527ed763fe525832891e0fc0df9badbb | Catalin(ux) M. BOIE | 2011-08-22 14:58:13 |
Do not count the time spent in sleep! | e585e5e0b0b3ce0637674cf320a6f044afa42982 | Catalin(ux) M. BOIE | 2011-08-22 14:57:28 |
Give a real example for bandwidth enforcing. | ca829bcb14183f7f5aa180bed4bf633199dc5839 | Catalin(ux) M. BOIE | 2011-08-22 14:57:01 |
Bump version to 0.7. | 1a51b690a50c482c9e727b3e8e129bbc2890f600 | Catalin(ux) M. BOIE | 2011-06-21 17:06:25 |
Corrected description and license. | 708b98d98bb5704f3bd265928f07cc94c18bd212 | Catalin(ux) M. BOIE | 2011-06-21 17:06:04 |
Bump version to 0.6. | cb4ef5c142753802f9dcd2410d094f9914e8273c | Catalin(ux) M. BOIE | 2011-06-21 16:56:15 |
Added support for separate FORCE_ADDR for IPv4 and IPv6, MSS, TTL etc. | e32e97cafe360f192283168d76c327559282e24d | Catalin(ux) M. BOIE | 2011-06-21 16:55:12 |
Added TODO to %doc rpm section. | 086dbb2e078955dddf83cbfd65998334d6db81e4 | Catalin(ux) M. BOIE | 2010-12-19 19:46:20 |
Added MSS. | 9a5c3676567cb92e6c0b4106c2b97cd2da2273a5 | Catalin(ux) M. BOIE | 2010-12-14 17:00:37 |
Added TOS test script. | a4b1b05b27b3eaa06a4a71f656e1b80731d1b8ff | Catalin(ux) M. BOIE | 2010-12-14 16:55:03 |
Ignore Changelog-last file. | 1bfa5decd11f4fd95e4b002d88e2a2e04c747855 | Catalin(ux) M. BOIE | 2010-12-14 16:54:36 |
Added KA. | ec9b4556e51ca9a807400910f8ca6d698f9ad670 | Catalin(ux) M. BOIE | 2010-12-14 16:53:58 |
Bump up the version to 0.5. | f7ba7f0feb49ac4942d85903d31e085f1ffa6149 | Catalin(ux) M. BOIE | 2010-11-07 23:16:25 |
Duilder updates. | 4d3691f340591f68f9b0ae704da24b4352957f05 | Catalin(ux) M. BOIE | 2010-11-07 23:15:29 |
Added support to force TOS by using env var FORCE_NET_TOS. | 319cfbee315a0c6889791b122fdb8069aa2ffdf1 | Catalin(ux) M. BOIE | 2010-11-07 23:14:23 |
No need for duilder_release. I will use a global one. | 15a59294aa3922e58bff8aaa9de7cc06dc44fe1e | Catalin(ux) M. BOIE | 2010-10-27 20:43:15 |
TODO in. | 9ea8407b8a2767debcf7597bbfc1bddfe44c78eb | Catalin(ux) M. BOIE | 2010-10-27 20:21:13 |
Typo. | 2282d895e91cf2b02a7b67d933af2c68db5798b6 | Catalin(ux) M. BOIE | 2010-10-27 19:54:40 |
Aded license information to README file. | fe8071fd2d9f912136fb7fa22f289ddc63cf0f14 | Catalin(ux) M. BOIE | 2010-10-27 19:46:48 |
Improved description. | 1f17958175bf3f2a656a365fdafca21118737cf1 | Catalin(ux) M. BOIE | 2010-10-27 19:43:33 |
File | Lines added | Lines deleted |
---|---|---|
send_udp.c | 25 | 12 |
test_bw1.sh | 1 | 1 |
test_bw2.sh | 2 | 2 |
File send_udp.c changed (mode: 100644) (index 96ea103..c28fc6e) | |||
9 | 9 | ||
10 | 10 | int main(int argc, char *argv[]) | int main(int argc, char *argv[]) |
11 | 11 | { | { |
12 | int sock, err; | ||
12 | int sock[10], err; | ||
13 | 13 | struct sockaddr_in sa; | struct sockaddr_in sa; |
14 | 14 | int port = 123; | int port = 123; |
15 | unsigned char buf[4096]; | ||
15 | unsigned char buf[4096 * 100]; | ||
16 | 16 | unsigned int bytes = 100000, rest, max; | unsigned int bytes = 100000, rest, max; |
17 | unsigned int chunk_len = 1000; | ||
18 | unsigned int i, connections = 2; | ||
17 | 19 | ||
18 | sock = socket(AF_INET, SOCK_DGRAM, 0); | ||
19 | if (sock == -1) { | ||
20 | perror("socket"); | ||
21 | return 1; | ||
20 | for (i = 0; i < connections; i++) { | ||
21 | sock[i] = socket(AF_INET, SOCK_DGRAM, 0); | ||
22 | if (sock[i] == -1) { | ||
23 | perror("socket"); | ||
24 | return 1; | ||
25 | } | ||
22 | 26 | } | } |
23 | 27 | ||
24 | 28 | if (argc >= 2) | if (argc >= 2) |
... | ... | int main(int argc, char *argv[]) | |
27 | 31 | if (argc >= 3) | if (argc >= 3) |
28 | 32 | bytes = strtol(argv[2], NULL, 10); | bytes = strtol(argv[2], NULL, 10); |
29 | 33 | ||
34 | if (argc >= 4) | ||
35 | chunk_len = strtol(argv[3], NULL, 10); | ||
36 | |||
30 | 37 | memset(&sa, 0, sizeof(struct sockaddr)); | memset(&sa, 0, sizeof(struct sockaddr)); |
31 | 38 | sa.sin_family = AF_INET; | sa.sin_family = AF_INET; |
32 | 39 | sa.sin_port = htons(port); | sa.sin_port = htons(port); |
... | ... | int main(int argc, char *argv[]) | |
39 | 46 | max = sizeof(buf); | max = sizeof(buf); |
40 | 47 | if (rest < max) | if (rest < max) |
41 | 48 | max = rest; | max = rest; |
42 | printf("Sending %u bytes...\n", max); | ||
43 | err = sendto(sock, buf, max, 0, (struct sockaddr *) &sa, sizeof(sa)); | ||
44 | if (err == -1) { | ||
45 | perror("sendto"); | ||
46 | break; | ||
49 | if (max > chunk_len) | ||
50 | max = chunk_len; | ||
51 | |||
52 | for (i = 0; i < connections; i++) { | ||
53 | printf("Sending %u bytes to connection %u...\n", max, i); | ||
54 | err = sendto(sock[i], buf, max, 0, (struct sockaddr *) &sa, sizeof(sa)); | ||
55 | if (err == -1) { | ||
56 | perror("sendto"); | ||
57 | break; | ||
58 | } | ||
47 | 59 | } | } |
48 | 60 | ||
49 | 61 | rest -= err; | rest -= err; |
50 | 62 | } | } |
51 | 63 | ||
52 | close(sock); | ||
64 | for (i = 0; i < connections; i++) | ||
65 | close(sock[i]); | ||
53 | 66 | ||
54 | 67 | return 0; | return 0; |
55 | 68 | } | } |
File test_bw1.sh changed (mode: 100755) (index 9a925f2..964f25f) | |||
4 | 4 | ||
5 | 5 | ulimit -c2000000 | ulimit -c2000000 |
6 | 6 | ||
7 | export FORCE_NET_BW="1000" | ||
7 | export FORCE_NET_BW=1000 | ||
8 | 8 | ||
9 | 9 | export LD_PRELOAD="${LD_PRELOAD}:./force_bind.so" | export LD_PRELOAD="${LD_PRELOAD}:./force_bind.so" |
10 | 10 |
File test_bw2.sh changed (mode: 100755) (index 6fda450..484f101) | |||
1 | 1 | #!/bin/sh | #!/bin/sh |
2 | 2 | ||
3 | # Test bandwidth limiting | ||
3 | # Test bandwidth limiting, per socket, with 2 connections | ||
4 | 4 | ||
5 | 5 | ulimit -c2000000 | ulimit -c2000000 |
6 | 6 | ||
7 | export FORCE_NET_BW_PER_SOCKET="1000" | ||
7 | export FORCE_NET_BW_PER_SOCKET=1000 | ||
8 | 8 | ||
9 | 9 | export LD_PRELOAD="${LD_PRELOAD}:./force_bind.so" | export LD_PRELOAD="${LD_PRELOAD}:./force_bind.so" |
10 | 10 |