|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
Опции темы | Поиск в этой теме |
03.04.2010, 17:11 | #1 |
Форумчанин
Регистрация: 18.04.2009
Сообщений: 688
|
recv Function
вот что MSDN дало:
The recv function receives data from a connected or bound socket. int recv( __in SOCKET s, __out char* buf, __in int len, __in int flags ); Parameters s The descriptor that identifies a connected socket. buf The buffer for incoming data. len The length, in bytes, of the buf parameter. flags A pointer to flags that influences the behavior of this function. See remarks below. Return Value If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError. The flags parameter can be used to influence the behavior of the function invocation beyond the options specified for the associated socket. The semantics of this function are determined by the socket options and the flags parameter. The latter is constructed by using the bitwise OR operator with any of the following values. Value Meaning MSG_PEEK Peeks at the incoming data. The data is copied into the buffer, but is not removed from the input queue. The function subsequently returns the amount of data that can be read in a single call to the recv (or recvfrom) function, which may not be the same as the total amount of data queued on the socket. The amount of data that can actually be read in a single call to the recv (or recvfrom) function is limited to the data size written in the send or sendto function call. MSG_OOB Processes Out Of Band (OOB) data. MSG_WAITALL The receive request will complete only when one of the following events occurs: The buffer supplied by the caller is completely full. The connection has been closed. The request has been canceled. Note that if the underlying transport does not support MSG_WAITALL, or if the socket is in a non-blocking mode, then this call will fail with WSAEOPNOTSUPP. Also, if MSG_WAITALL is specified along with MSG_OOB, MSG_PEEK, or MSG_PARTIAL, then this call will fail with WSAEOPNOTSUPP. This flag is not supported on datagram sockets or message-oriented CO sockets. ВОПРОС. 1. где-то встретил что на месте flags был написан 0, вместо этих 3ёх констант, что бы это могло значить? 2. MSG_OOB Processes Out Of Band (OOB) data. как это понять???? что такое OOB? |
03.04.2010, 17:53 | #2 |
Старожил
Регистрация: 28.01.2009
Сообщений: 21,000
|
1)0 это значит что ни один из флагов не применяется.
2)не знаю если честно.. Хорошо поставленный вопрос это уже половина ответа. | Каков вопрос, таков ответ.
Программа делает то что написал программист, а не то что он хотел. Функции/утилиты ждут в параметрах то что им надо, а не то что вы хотите. |
04.04.2010, 11:53 | #3 | |
Участник клуба Подтвердите свой е-майл
Регистрация: 19.11.2007
Сообщений: 1,022
|
Цитата:
|
|
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
MPI: send и recv | cheparamba | Общие вопросы C/C++ | 0 | 09.03.2010 05:48 |
Функция recv (Winsock) | YYYYY | Работа с сетью в Delphi | 0 | 18.02.2010 02:16 |
Зацикливается recv. | asdo | Общие вопросы C/C++ | 4 | 23.01.2010 23:38 |
recv() | Артэс | C/C++ Сетевое программирование | 7 | 15.01.2010 14:51 |
WinSock (send, recv) | AidarBik | Работа с сетью в Delphi | 1 | 27.07.2008 15:22 |