Форум: "Сети";
Текущий архив: 2003.09.01;
Скачать: [xml.tar.bz2];
ВнизSocket Найти похожие ветки
← →
BJValentine (2003-06-24 13:10) [0]Посылаю в цикле серверу строки, а сервер принимает их как одну большуб строку. Как с этим бороться?
← →
Alien (2003-06-24 14:05) [1]Ставь в конце каждой строки какой-нибудь символ.
← →
panov (2003-06-24 14:07) [2]Если кроме строковой информации ничего не передаешь, то пользуйся разделителем строк, например #13#10, или просто #10.
на принимающей стороне разбирай принятую информацию на строки.
← →
BJValentine (2003-06-24 14:10) [3]А почему так происходит?
← →
Alien (2003-06-24 14:14) [4]Принимающая сторона не успевает читать из сокета все что ты в него пишешь в цикле
← →
Digitman (2003-06-24 14:26) [5]
> BJValentine
потому что ТСР-протокол - поточный
← →
antdrnc (2003-06-25 17:40) [6]На передающей стороне socket буферизует данные.
Передача данных происходит при заполнении буфера или по истечении
интервала времени.
Можно отключить буферизацию данных для конкретного socket.
Посмотри setsockopt(sock,IPPROTO_TCP,TCP_NODELAY,...)
← →
Digitman (2003-06-26 08:13) [7]CP_NODELAY
The TCP_NODELAY option is specific to TCP/IP service providers. Enabling the TCP_NODELAY option disables the TCP Nagle Algorithm (and vice versa). The Nagle algorithm (described in RFC 896) is very effective in reducing the number of small packets sent by a host by essentially buffering send data if there is unacknowledged data already "in flight" or until a full-size packet can be sent. It is highly recommended that TCP/IP service providers enable the Nagle Algorithm by default, and for the vast majority of application protocols the Nagle Algorithm can deliver significant performance enhancements. However, for some applications this algorithm can impede performance, and TCP_NODELAY can be used to turn it off. These are applications where many small messages are sent, which need to be received by the peer with the time delays between the messages maintained. Application writers should not set TCP_NODELAY unless the impact of doing so is well-understood and desired, since setting TCP_NODELAY can have a significant negative impact of network and application performance.
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2003.09.01;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.012 c