Книга: UNIX: разработка сетевых приложений

Запуск измененной программы

Запуск измененной программы

Запустив сервер и измененный клиент, мы получаем следующий результат:

freebsd4% sctpclient01 10.1.4.1 echo
Echoing messages to all streams
Hello
From str:0 seq:0 (assoc:0xc99e15a0):Hello.msg.0 1
From str:0 seq:1 (assoc:0xc99e15a0):Hello.msg.0 2
From str:1 seq:0 (assoc:0xc99e15a0):Hello.msg.1 1
From str:4 seq:0 (assoc:0xc99e15a0):Hello.msg.4 1
From str:5 seq:0 (assoc:0xc99e15a0):Hello.msg.5 1
From str:7 seq:0 (assoc:0xc99e15a0):Hello.msg.7 1
From str:8 seq:0 (assoc:0xc99e15a0):Hello.msg.8 1
From str:9 seq:0 (assoc:0xc99e15a0):Hello.msg.9 1
From str:3 seq:0 (assoc:0xc99e15a0):Hello.msg.3 1
From str:3 seq:0 (assoc:0xc99e15a0):Hello.msg.3 2
From str:1 seq:0 (assoc:0xc99e15a0):Hello.msg.1 2
From str:5 seq:0 (assoc:0xc99e15a0):Hello.msg.5 2
From str:2 seq:0 (assoc:0xc99e15a0):Hello.msg.2 1
From str:6 seq:0 (assoc:0xc99e15a0):Hello.msg.6 1
From str:6 seq:0 (assoc:0xc99e15a0):Hello.msg.6 2
From str:2 seq:0 (assoc:0xc99e15a0):Hello.msg.2 2
From str:7 seq:0 (assoc:0xc99e15a0):Hello.msg.7 2
From str:8 seq:0 (assoc:0xc99e15a0):Hello.msg.8 2
From str:9 seq:0 (assoc:0xc99e15a0):Hello.msg.9 2
From str:4 seq:0 (assoc:0xc99e15a0):Hello.msg.4 2
^D
freebsd4%

Как видно из вывода, сообщения действительно теряются, но при этом задерживаются только те, которые относятся к конкретному потоку. Данные в остальных потоках не задерживаются. Потоки SCTP могут послужить мощным средством борьбы с блокированием очереди, позволяющим в то же время сохранять порядок данных в рамках конкретного набора сообщений.

Оглавление книги


Генерация: 0.082. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз