Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: WSASocket  (Прочитано 7185 раз)
0 Пользователей и 1 Гость смотрят эту тему.
Olegg
Гость
« : 29-06-2004 06:54 » 

Подскажите пожалуйста!
Прога клиент-сервер, чем больше добовляю сокетов и каналов тем больше глюков (например: разрывается канал
при перемещении окна).
:?: :?:  :?:
Записан
Anonymous
Гость
« Ответ #1 : 07-10-2004 17:16 » 

С помощью функции bind (она не асинхронна) устанавливается длина очереди прослушивания, может ее и не хватает. Кстати оптимально рекомендуют <= 5.
Записан
Mike_mvk
Гость
« Ответ #2 : 18-10-2004 13:50 » 

С этого места подробнее, пожалуйста.
Записан
lapulya
Молодой специалист

ru
Offline Offline

« Ответ #3 : 18-10-2004 14:28 » 

Цитата

С помощью функции bind (она не асинхронна) устанавливается длина очереди прослушивания, может ее и не хватает. Кстати оптимально рекомендуют <= 5.

Гость, ты почти угадал, только это не bind, а listen, вот что по этому поводу пишет MSDN
Цитата

The Windows Sockets listen function places a socket a state where it is listening for an incoming connection.

int listen (
  SOCKET s,    
  int backlog  
);
 
Parameters
s
[in] A descriptor identifying a bound, unconnected socket.
backlog
[in] The maximum length of the queue of pending connections. If this value is SOMAXCONN, then the underlying service provider responsible for socket s will set the backlog to a maximum "reasonable" value. There is no standard provision to find out the actual backlog value.
Remarks
To accept connections, a socket is first created with the socket function and bound to a local address with the bind function, a backlog for incoming connections is specified with listen, and then the connections are accepted with the accept function. Sockets that are connection oriented, those of type SOCK_STREAM for example, are used with listen. The socket s is put into "passive'' mode where incoming connection requests are acknowledged and queued pending acceptance by the process.

The listen function is typically used by servers that can have more than one connection request at a time. If a connection request arrives and the queue is full, the client will receive an error with an indication of WSAECONNREFUSED.

If there are no available socket descriptors, listen attempts to continue to function. If descriptors become available, a later call to listen or accept will refill the queue to the current or most recent "backlog'', if possible, and resume listening for incoming connections.

An application can call listen more than once on the same socket. This has the effect of updating the current backlog for the listening socket. Should there be more pending connections than the new backlog value, the excess pending connections will be reset and dropped.

Записан

С уважением Lapulya
lapulya
Молодой специалист

ru
Offline Offline

« Ответ #4 : 18-10-2004 14:34 » 

да ... могу добавить что
Код:

#define SOMAXCONN       5
Записан

С уважением Lapulya
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines