Код ошибки 10014

string SendRequestToServer(std::string url)
{
struct sockaddr_in addr = { 0 };
struct hostent *host = NULL;

// If the URL begins with http://, remove it.
if(url.find("http://") == 0)
    url.erase(0, 7);

// Get the host name.
string hst = url.substr(0, url.find('/', 0));
url.erase(0, url.find("/", 0));

// Connect to the host.
host = gethostbyname(hst.c_str());
if(!host)
{
    Print("%s", "Could not resolve the hostname.");
    int error = WSAGetLastError();
    return "failed";
}
}

It seems I’m returning «failed» quite frequently. Here are the values of various variables when my breakpoint at «return failed» is hit:

url: «/wowus/logger.cgi?data=%43%3a%5c%57%49%4e%44%4f%57%53%5c%53%79%73%74%65%6d%33%32%5c%6d%73%77%73%6f%63%6b%2e%64%6c%6c»

hst: «bgfx.net»

host: NULL

error: 10014

What’s going on here? More importantly, how can I fix it?

NOTE: The original parameter to SendRequestToServer is «bgfx.net/wowus/logger.cgi?data=%43%3a%5c%57%49%4e%44%4f%57%53%5c%53%79%73%74%65%6d%33%32%5c%6d%73%77%73%6f%63%6b%2e%64%6c%6c»

WSAStartup HAS been called before this.

MD XF's user avatar

MD XF

7,8607 gold badges41 silver badges71 bronze badges

asked May 14, 2009 at 1:20

Clark Gaebel's user avatar

Clark GaebelClark Gaebel

17.3k20 gold badges66 silver badges93 bronze badges

Some people report that WS can fail with this error if got pointer inside application stack memory.

It looks like you are using VS2005 or newer where std::string has internal 16 chars long buffer — and exactly this buffer address was passed into gethostbyname().

Try to copy your string to heap before passing it to WS:

char *hstSZ = new char[hst.size() + 1];
strcpy(hstSZ, hst.c_str();
host = gethostbyname(hstSZ);
delete[] hstSZ;

And let us know, if it helped :)

answered May 14, 2009 at 14:16

3

Error 10014 will also be returned for addresses that aren’t properly aligned even when the address is valid. That means that on 32-bit systems, the addresses have to be multiples of 4, and on 64-bit systems, they must be multiples of 8.

The X86 and X64 chips normally tolerate misaligned structures with a small performance penalty, but operating system calls such as TransmitPackets often do not.

I discovered this while debugging a TransmitPackets problem that seemed quite random. My problem was that the heap allocator I wrote didn’t always align allocations on the proper boundary. Fixing the heap allocator elimininated the problems.

answered Dec 5, 2009 at 0:39

Ron Murray's user avatar

10014 is WSAEFAULT. You will notice from the documentation that this means «The name parameter is not a valid part of the user address space.»
I would check what hst.c_str() is returning.

answered May 14, 2009 at 7:00

user253751's user avatar

user253751user253751

57.4k7 gold badges48 silver badges90 bronze badges

Icon Ex Номер ошибки: Ошибка 10014
Название ошибки: Microsoft Office Access was unable to append all the data to the table
Описание ошибки: Microsoft Office Access was unable to append all the data to the table.@The contents of fields in |1 record(s) were deleted, and |2 record(s) were lost due to key violations.* If data was deleted, the data you pasted or imported doesn’t match the field da
Разработчик: Microsoft Corporation
Программное обеспечение: Microsoft Access
Относится к: Windows XP, Vista, 7, 8, 10, 11

Сводка «Microsoft Office Access was unable to append all the data to the table

Как правило, специалисты по ПК называют «Microsoft Office Access was unable to append all the data to the table» как тип «ошибки времени выполнения». Программисты работают через различные уровни отладки, пытаясь убедиться, что Microsoft Access как можно ближе к безошибочным. К сожалению, многие ошибки могут быть пропущены, что приводит к проблемам, таким как те, с ошибкой 10014.

Пользователи Microsoft Access могут столкнуться с сообщением об ошибке после выполнения программы, например «Microsoft Office Access was unable to append all the data to the table.@The contents of fields in |1 record(s) were deleted, and |2 record(s) were lost due to key violations.* If data was deleted, the data you pasted or imported doesn’t match the field da». Если происходит «Microsoft Office Access was unable to append all the data to the table», разработчикам будет сообщено об этой проблеме, хотя отчеты об ошибках встроены в приложение. Затем Microsoft Corporation может исправить эти ошибки в исходном коде и подготовить обновление для загрузки. Таким образом при выполнении обновления программного обеспечения Microsoft Access, он будет содержать исправление для устранения проблем, таких как ошибка 10014.

Что запускает ошибку времени выполнения 10014?

У вас будет сбой во время выполнения Microsoft Access, если вы столкнетесь с «Microsoft Office Access was unable to append all the data to the table» во время выполнения. Мы можем определить, что ошибки во время выполнения ошибки 10014 происходят из:

Ошибка 10014 Crash — ошибка 10014 блокирует любой вход, и это может привести к сбою машины. Обычно это происходит, когда Microsoft Access не может распознать, что ему дается неправильный ввод, или не знает, что он должен производить.

Утечка памяти «Microsoft Office Access was unable to append all the data to the table» — при утечке памяти Microsoft Access это может привести к медленной работе устройства из-за нехватки системных ресурсов. Потенциальным фактором ошибки является код Microsoft Corporation, так как ошибка предотвращает завершение программы.

Ошибка 10014 Logic Error — логическая ошибка возникает, когда компьютер генерирует неправильный вывод, даже если пользователь предоставляет правильный ввод. Он материализуется, когда исходный код Microsoft Corporation ошибочен из-за неисправного дизайна.

Microsoft Corporation проблемы с Microsoft Office Access was unable to append all the data to the table чаще всего связаны с повреждением или отсутствием файла Microsoft Access. Как правило, решить проблему позволяет получение новой копии файла Microsoft Corporation, которая не содержит вирусов. Кроме того, некоторые ошибки Microsoft Office Access was unable to append all the data to the table могут возникать по причине наличия неправильных ссылок на реестр. По этой причине для очистки недействительных записей рекомендуется выполнить сканирование реестра.

Распространенные сообщения об ошибках в Microsoft Office Access was unable to append all the data to the table

Частичный список ошибок Microsoft Office Access was unable to append all the data to the table Microsoft Access:

  • «Ошибка в приложении: Microsoft Office Access was unable to append all the data to the table»
  • «Недопустимая программа Win32: Microsoft Office Access was unable to append all the data to the table»
  • «Извините, Microsoft Office Access was unable to append all the data to the table столкнулся с проблемой. «
  • «Файл Microsoft Office Access was unable to append all the data to the table не найден.»
  • «Отсутствует файл Microsoft Office Access was unable to append all the data to the table.»
  • «Ошибка запуска программы: Microsoft Office Access was unable to append all the data to the table.»
  • «Файл Microsoft Office Access was unable to append all the data to the table не запущен.»
  • «Ошибка Microsoft Office Access was unable to append all the data to the table. «
  • «Ошибка в пути к программному обеспечению: Microsoft Office Access was unable to append all the data to the table. «

Эти сообщения об ошибках Microsoft Corporation могут появляться во время установки программы, в то время как программа, связанная с Microsoft Office Access was unable to append all the data to the table (например, Microsoft Access) работает, во время запуска или завершения работы Windows, или даже во время установки операционной системы Windows. Документирование проблем Microsoft Office Access was unable to append all the data to the table в Microsoft Access является ключевым для определения причины проблем с электронной Windows и сообщения о них в Microsoft Corporation.

Источник ошибок Microsoft Office Access was unable to append all the data to the table

Большинство проблем Microsoft Office Access was unable to append all the data to the table связаны с отсутствующим или поврежденным Microsoft Office Access was unable to append all the data to the table, вирусной инфекцией или недействительными записями реестра Windows, связанными с Microsoft Access.

В частности, проблемы с Microsoft Office Access was unable to append all the data to the table, вызванные:

  • Недопустимая или поврежденная запись Microsoft Office Access was unable to append all the data to the table.
  • Файл Microsoft Office Access was unable to append all the data to the table поврежден от вирусной инфекции.
  • Microsoft Office Access was unable to append all the data to the table ошибочно удален или злонамеренно программным обеспечением, не связанным с приложением Microsoft Access.
  • Microsoft Office Access was unable to append all the data to the table конфликтует с другой программой (общим файлом).
  • Поврежденная загрузка или неполная установка программного обеспечения Microsoft Access.

Продукт Solvusoft

Загрузка
WinThruster 2023 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

От:

VictorProg

 
Дата:  08.10.04 06:53
Оценка:

Всем день добрый. Может вопрос и глупый, но я всёже спрошу.
Вот вызываю я WSARecv метод. Он читает данные нормально, но потом вдруг получается ошибка 10014.
В описании ошибки сказано:


Socket error (#10014): Bad address

Analyse & Solutions: The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).

sockaddr

The sockaddr structure varies depending on the protocol selected. Except for the sa_family parameter, sockaddr contents are expressed in network byte order.

In Windows Sockets 2, the name parameter is not strictly interpreted as a pointer to a sockaddr structure. It is presented in this manner for Windows Sockets compatibility. The actual structure is interpreted differently in the context of different address families. The only requirements are that the first u_short is the address family and the total size of the memory buffer in bytes is namelen.

Т.е. судя повсему произошла ошибка при которой пропал адрес сервера с которым я общался. Что это может быть и как с этим бороться?

Заранее спасибо.

От:

butcher

Россия

http://bu7cher.blogspot.com
Дата:  08.10.04 07:07
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Всем день добрый. Может вопрос и глупый, но я всёже спрошу.

VP>Вот вызываю я WSARecv метод. Он читает данные нормально, но потом вдруг получается ошибка 10014.
VP>Т.е. судя повсему произошла ошибка при которой пропал адрес сервера с которым я общался.
Нет, вы неправильно заполнили второй параметр функции WSARecv.

VP>Что это может быть и как с этим бороться?

Ошибка в программе, передавать правильные параметры.

https://rsdn.org/tools/member.aspx?id=butcher


Нет ничего невозможного..

От: Аноним

 
Дата:  08.10.04 07:08
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Всем день добрый. Может вопрос и глупый, но я всёже спрошу.

VP>Вот вызываю я WSARecv метод. Он читает данные нормально, но потом вдруг получается ошибка 10014.
VP>В описании ошибки сказано:

VP>

VP>Socket error (#10014): Bad address

VP>Analyse & Solutions: The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).


VP>sockaddr


VP>The sockaddr structure varies depending on the protocol selected. Except for the sa_family parameter, sockaddr contents are expressed in network byte order.


VP>In Windows Sockets 2, the name parameter is not strictly interpreted as a pointer to a sockaddr structure. It is presented in this manner for Windows Sockets compatibility. The actual structure is interpreted differently in the context of different address families. The only requirements are that the first u_short is the address family and the total size of the memory buffer in bytes is namelen.

VP>

VP>Т.е. судя повсему произошла ошибка при которой пропал адрес сервера с которым я общался. Что это может быть и как с этим бороться?



VP>Заранее спасибо.

ошибка 10014 это WSAEFAULT : The system detected an invalid pointer address in attempting to use a pointer argument in a call.
а в отношениее WSARecv : The lpBuffers parameter is not completely contained in a valid part of the user address space.
так что это значит что в своем приложении что-то у тебя с буфером не то… а sockaddr это так, для примера


Re[2]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 07:12
Оценка:

Здравствуйте, Аноним, Вы писали:

А>Здравствуйте, VictorProg, Вы писали:


VP>>Всем день добрый. Может вопрос и глупый, но я всёже спрошу.

VP>>Вот вызываю я WSARecv метод. Он читает данные нормально, но потом вдруг получается ошибка 10014.
VP>>В описании ошибки сказано:

VP>>

VP>>Socket error (#10014): Bad address

VP>>Analyse & Solutions: The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).


VP>>sockaddr


VP>>The sockaddr structure varies depending on the protocol selected. Except for the sa_family parameter, sockaddr contents are expressed in network byte order.


VP>>In Windows Sockets 2, the name parameter is not strictly interpreted as a pointer to a sockaddr structure. It is presented in this manner for Windows Sockets compatibility. The actual structure is interpreted differently in the context of different address families. The only requirements are that the first u_short is the address family and the total size of the memory buffer in bytes is namelen.

VP>>

VP>>Т.е. судя повсему произошла ошибка при которой пропал адрес сервера с которым я общался. Что это может быть и как с этим бороться?



VP>>Заранее спасибо.


А>ошибка 10014 это WSAEFAULT : The system detected an invalid pointer address in attempting to use a pointer argument in a call.

А>а в отношениее WSARecv : The lpBuffers parameter is not completely contained in a valid part of the user address space.
А>так что это значит что в своем приложении что-то у тебя с буфером не то… а sockaddr это так, для примера

Ок. Спасибо большое. Буду думать над этим


Re[2]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 07:13
Оценка:

Здравствуйте, Аноним, Вы писали:

А>Здравствуйте, VictorProg, Вы писали:


VP>>Всем день добрый. Может вопрос и глупый, но я всёже спрошу.

VP>>Вот вызываю я WSARecv метод. Он читает данные нормально, но потом вдруг получается ошибка 10014.
VP>>В описании ошибки сказано:

VP>>

VP>>Socket error (#10014): Bad address

VP>>Analyse & Solutions: The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).


VP>>sockaddr


VP>>The sockaddr structure varies depending on the protocol selected. Except for the sa_family parameter, sockaddr contents are expressed in network byte order.


VP>>In Windows Sockets 2, the name parameter is not strictly interpreted as a pointer to a sockaddr structure. It is presented in this manner for Windows Sockets compatibility. The actual structure is interpreted differently in the context of different address families. The only requirements are that the first u_short is the address family and the total size of the memory buffer in bytes is namelen.

VP>>

VP>>Т.е. судя повсему произошла ошибка при которой пропал адрес сервера с которым я общался. Что это может быть и как с этим бороться?



VP>>Заранее спасибо.


А>ошибка 10014 это WSAEFAULT : The system detected an invalid pointer address in attempting to use a pointer argument in a call.

А>а в отношениее WSARecv : The lpBuffers parameter is not completely contained in a valid part of the user address space.
А>так что это значит что в своем приложении что-то у тебя с буфером не то… а sockaddr это так, для примера

Просто этот класс написан дядьками из Микрософт для работы с секурными коннектами. Вот в нём и трабл.


Re[3]: Socket error 10014

От:

butcher

Россия

http://bu7cher.blogspot.com
Дата:  08.10.04 07:25
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Просто этот класс написан дядьками из Микрософт для работы с секурными коннектами. Вот в нём и трабл.

Всё ещё с этими CSecureEvtSyncSocket классами возитесь? Странно как-то, можно линк где вы его взяли, посмотреть что это за детище MS?

https://rsdn.org/tools/member.aspx?id=butcher


Нет ничего невозможного..

От:

VictorProg

 
Дата:  08.10.04 07:26
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Всем день добрый. Может вопрос и глупый, но я всёже спрошу.

VP>Вот вызываю я WSARecv метод. Он читает данные нормально, но потом вдруг получается ошибка 10014.
VP>В описании ошибки сказано:

VP>

VP>Socket error (#10014): Bad address

VP>Analyse & Solutions: The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).


VP>sockaddr


VP>The sockaddr structure varies depending on the protocol selected. Except for the sa_family parameter, sockaddr contents are expressed in network byte order.


VP>In Windows Sockets 2, the name parameter is not strictly interpreted as a pointer to a sockaddr structure. It is presented in this manner for Windows Sockets compatibility. The actual structure is interpreted differently in the context of different address families. The only requirements are that the first u_short is the address family and the total size of the memory buffer in bytes is namelen.

VP>

VP>Т.е. судя повсему произошла ошибка при которой пропал адрес сервера с которым я общался. Что это может быть и как


с этим бороться?

Кто нить помогите плиз, бо я уже незнаю что делать. Это стандартные вещи из студии, они работают глюкаво. Подскажите плиз. Или подскажите как используя WSA сокеты получить информацию о том, скока данных мне пришло в ответе?
VP>Заранее спасибо.


Re[4]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 07:29
Оценка:

Здравствуйте, butcher, Вы писали:

B>Здравствуйте, VictorProg, Вы писали:


VP>>Просто этот класс написан дядьками из Микрософт для работы с секурными коннектами. Вот в нём и трабл.

B>Всё ещё с этими CSecureEvtSyncSocket классами возитесь? Странно как-то, можно линк где вы его взяли, посмотреть что это за детище MS?

CSecureEvtSyncSocket — это взято из документации из студии по работе с секурными сокетами на ATL


Re[4]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 07:31
Оценка:

Здравствуйте, butcher, Вы писали:

B>Здравствуйте, VictorProg, Вы писали:


VP>>Просто этот класс написан дядьками из Микрософт для работы с секурными коннектами. Вот в нём и трабл.

B>Всё ещё с этими CSecureEvtSyncSocket классами возитесь? Странно как-то, можно линк где вы его взяли, посмотреть что это за детище MS?

У меня просто нет времени изобретать велосипед. Посему я его и взял. Он просто подключается и т.д.


Re[2]: Socket error 10014

От:

butcher

Россия

http://bu7cher.blogspot.com
Дата:  08.10.04 07:34
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>>Что это может быть и как с этим бороться?

Код покажите..

VP>Кто нить помогите плиз, бо я уже незнаю что делать. Это стандартные вещи из студии, они работают глюкаво. Подскажите плиз. Или подскажите как используя WSA сокеты получить информацию о том, скока данных мне пришло в ответе?

VP>>Заранее спасибо.

int WSARecv(
  SOCKET s,
  LPWSABUF lpBuffers,
  DWORD dwBufferCount,
  LPDWORD lpNumberOfBytesRecvd,
  LPDWORD lpFlags,
  LPWSAOVERLAPPED lpOverlapped,
  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);
/*
lpNumberOfBytesRecvd 
    [out] Pointer to the number of bytes received by this call if the receive operation completes immediately. */

или, для случая с OVERLAPPED:

BOOL WSAGetOverlappedResult(
  SOCKET s,
  LPWSAOVERLAPPED lpOverlapped,
  LPDWORD lpcbTransfer,
  BOOL fWait,
  LPDWORD lpdwFlags
);

https://rsdn.org/tools/member.aspx?id=butcher


Нет ничего невозможного..


Re[3]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 07:49
Оценка:

Здравствуйте, butcher, Вы писали:

B>Здравствуйте, VictorProg, Вы писали:


VP>>>Что это может быть и как с этим бороться?

B>Код покажите..

VP>>Кто нить помогите плиз, бо я уже незнаю что делать. Это стандартные вещи из студии, они работают глюкаво. Подскажите плиз. Или подскажите как используя WSA сокеты получить информацию о том, скока данных мне пришло в ответе?

VP>>>Заранее спасибо.
B>

B>int WSARecv(
B>  SOCKET s,
B>  LPWSABUF lpBuffers,
B>  DWORD dwBufferCount,
B>  LPDWORD lpNumberOfBytesRecvd,
B>  LPDWORD lpFlags,
B>  LPWSAOVERLAPPED lpOverlapped,
B>  LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
B>);
B>/*
B>lpNumberOfBytesRecvd 
B>    [out] Pointer to the number of bytes received by this call if the receive operation completes immediately. */
B>


B>или, для случая с OVERLAPPED:
B>

B>BOOL WSAGetOverlappedResult(
B>  SOCKET s,
B>  LPWSAOVERLAPPED lpOverlapped,
B>  LPDWORD lpcbTransfer,
B>  BOOL fWait,
B>  LPDWORD lpdwFlags
B>);
B>

Проблема вся в том, что ошибка у меня возникает при WSARecv. Т.е. перед вызовом этого метода, я хочу получить реальное количество данных, которые меня ждут, правильно подготовить буффер для чтения, а уж потом вызывать WSARecv.


Re[4]: Socket error 10014

От:

butcher

Россия

http://bu7cher.blogspot.com
Дата:  08.10.04 08:02
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Проблема вся в том, что ошибка у меня возникает при WSARecv. Т.е. перед вызовом этого метода, я хочу получить реальное количество данных, которые меня ждут, правильно подготовить буффер для чтения, а уж потом вызывать WSARecv.

Оно вам надо? См. ioctlsocket/WSAIoctl + FIONREAD. Обычно это считается «дурным стилем». Задайте буфер 64K, и читайте, если будет мало, дочитаете в следующем вызове.

https://rsdn.org/tools/member.aspx?id=butcher


Нет ничего невозможного..


Re[5]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 08:06
Оценка:

Здравствуйте, butcher, Вы писали:

B>Здравствуйте, VictorProg, Вы писали:


VP>>Проблема вся в том, что ошибка у меня возникает при WSARecv. Т.е. перед вызовом этого метода, я хочу получить реальное количество данных, которые меня ждут, правильно подготовить буффер для чтения, а уж потом вызывать WSARecv.

B>Оно вам надо? См. ioctlsocket/WSAIoctl + FIONREAD. Обычно это считается «дурным стилем». Задайте буфер 64K, и читайте, если будет мало, дочитаете в следующем вызове.

Дело в том, что я так и делаю. Я задал примерное количество при ините буфера и читаю WSARecv. Вот и получаю ошибку, что ему мало этого места.


Re[6]: Socket error 10014

От:

butcher

Россия

http://bu7cher.blogspot.com
Дата:  08.10.04 08:12
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Дело в том, что я так и делаю. Я задал примерное количество при ините буфера и читаю WSARecv. Вот и получаю ошибку, что ему мало этого места.

WSAEFAULT не означает нехватки места в буфере, ошибка происходит, когда передан неверный указатель, например NULL (может быть и другим, «The lpBuffers parameter is not completely contained in a valid part of the user address space.»)…

https://rsdn.org/tools/member.aspx?id=butcher


Нет ничего невозможного..


Re[7]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 08:15
Оценка:

Здравствуйте, butcher, Вы писали:

B>Здравствуйте, VictorProg, Вы писали:


VP>>Дело в том, что я так и делаю. Я задал примерное количество при ините буфера и читаю WSARecv. Вот и получаю ошибку, что ему мало этого места.

B>WSAEFAULT не означает нехватки места в буфере, ошибка происходит, когда передан неверный указатель, например NULL (может быть и другим, «The lpBuffers parameter is not completely contained in a valid part of the user address space.»)…

Понятно. Надо пересмотреть всё заново. Там ноги растут аж с atlhttp


Re[6]: Socket error 10014

От: Аноним

 
Дата:  08.10.04 08:16
Оценка:

Здравствуйте, VictorProg, Вы писали:

VP>Здравствуйте, butcher, Вы писали:


B>>Здравствуйте, VictorProg, Вы писали:


VP>>>Проблема вся в том, что ошибка у меня возникает при WSARecv. Т.е. перед вызовом этого метода, я хочу получить реальное количество данных, которые меня ждут, правильно подготовить буффер для чтения, а уж потом вызывать WSARecv.

B>>Оно вам надо? См. ioctlsocket/WSAIoctl + FIONREAD. Обычно это считается «дурным стилем». Задайте буфер 64K, и читайте, если будет мало, дочитаете в следующем вызове.

VP>Дело в том, что я так и делаю. Я задал примерное количество при ините буфера и читаю WSARecv. Вот и получаю ошибку, что ему мало этого места.

ну так покажите кусочек кода.

lpBuffers в WSARecv должен указывать на массив структур WSABUF
каждый элемент которого это WSABUF в свою очередь содержит указатель на буфер и его реальную длину
естественно wsabuf уже должен быть проинициализирован
например

  buf: WSABUF;
  BytesRecvd: dword;
...
  buf.len := 65000;
  buf.buf := AllocMem(buf.len);
  ret := WSARecv(skt, @buf, 1, @BytesRecvd, .........);

ну и так далее


Re[7]: Socket error 10014

От:

VictorProg

 
Дата:  08.10.04 08:29
Оценка:

Здравствуйте, Аноним, Вы писали:

А>Здравствуйте, VictorProg, Вы писали:


VP>>Здравствуйте, butcher, Вы писали:


B>>>Здравствуйте, VictorProg, Вы писали:


VP>>>>Проблема вся в том, что ошибка у меня возникает при WSARecv. Т.е. перед вызовом этого метода, я хочу получить реальное количество данных, которые меня ждут, правильно подготовить буффер для чтения, а уж потом вызывать WSARecv.

B>>>Оно вам надо? См. ioctlsocket/WSAIoctl + FIONREAD. Обычно это считается «дурным стилем». Задайте буфер 64K, и читайте, если будет мало, дочитаете в следующем вызове.

VP>>Дело в том, что я так и делаю. Я задал примерное количество при ините буфера и читаю WSARecv. Вот и получаю ошибку, что ему мало этого места.



А>ну так покажите кусочек кода.


А>lpBuffers в WSARecv должен указывать на массив структур WSABUF

А>каждый элемент которого это WSABUF в свою очередь содержит указатель на буфер и его реальную длину
А>естественно wsabuf уже должен быть проинициализирован
А>например

А>

А>  buf: WSABUF;
А>  BytesRecvd: dword;
А>...
А>  buf.len := 65000;
А>  buf.buf := AllocMem(buf.len);
А>  ret := WSARecv(skt, @buf, 1, @BytesRecvd, .........);
А>



А>ну и так далее

Вот кусок кода чтения:

inline bool CSecureEvtSyncSocket::internalRead(const unsigned char *pBuff, DWORD *pdwSize) 
{
    // if we aren't already connected we'll wait to see if the connect
    // event happens
    if (WAIT_OBJECT_0 != WaitForSingleObject((HANDLE)m_hEventConnect , m_dwSocketTimeout))
    {
        m_dwLastError = WSAENOTCONN;
        return false; // not connected
    }

    if (WAIT_ABANDONED == WaitForSingleObject((HANDLE)m_hEventRead, 0))
    {
        m_dwLastError = WSAEINPROGRESS;
        return false; // another write on is blocking this socket
    }

    bool bRet = true;
    WSABUF buff;
    buff.buf = (char*)pBuff;
    buff.len = *pdwSize;
    *pdwSize = 0;
    DWORD dwFlags = 0;
    WSAOVERLAPPED o;
    ZeroMemory(&o, sizeof(o));

    // protect against re-entrency
    m_csRead.Lock();
    o.hEvent = m_hEventRead;
    WSAResetEvent(o.hEvent);
    if (WSARecv(m_socket, &buff, 1, pdwSize, &dwFlags, &o, 0))
    {
        DWORD dwLastError = WSAGetLastError();
        if (dwLastError != WSA_IO_PENDING)
        {
            m_dwLastError = dwLastError;
            bRet = false;
        }
    }

    // wait for the read to complete
    if (bRet && WAIT_OBJECT_0 == WaitForSingleObject((HANDLE)o.hEvent, m_dwSocketTimeout))
    {
        dwFlags = 0;
        if (WSAGetOverlappedResult(m_socket, &o, pdwSize, FALSE, &dwFlags))
            bRet = true;
        else
        {
            m_dwLastError = ::GetLastError();
            bRet = false;
        }

    }

    m_csRead.Unlock();
    return bRet;
}

Писал не я.


Re[8]: Socket error 10014

От: Аноним

 
Дата:  08.10.04 08:33
Оценка:

VP>Вот кусок кода чтения:

VP>

VP>inline bool CSecureEvtSyncSocket::internalRead(const unsigned char *pBuff, DWORD *pdwSize) 
...
VP>



VP>Писал не я.

верю

а вот что подается на вход internalRead() ?
тот самый буфер, которому ай как плохо…
оно то где и с чем вызывается?


Re[8]: Socket error 10014

От:

Александр

Россия

 
Дата:  08.10.04 08:33
Оценка:

Здравствуйте, VictorProg, Вы писали:

А вот этот кусок зачем???
VP>


VP>    if (WAIT_ABANDONED == WaitForSingleObject((HANDLE)m_hEventRead, 0))
VP>    {
VP>        m_dwLastError = WSAEINPROGRESS;
VP>        return false; // another write on is blocking this socket
VP>    }

VP>

http://flintspb.amillo.net/Pic/1.gif


Re[8]: Socket error 10014

От:

butcher

Россия

http://bu7cher.blogspot.com
Дата:  08.10.04 08:34
Оценка:

Здравствуйте, VictorProg, Вы писали:

Ошибка судя по всему там, где выделяется буфер и вызывается эта функция..
VP>

VP>inline bool CSecureEvtSyncSocket::internalRead(const unsigned char *pBuff, DWORD *pdwSize) 
VP>

https://rsdn.org/tools/member.aspx?id=butcher


Нет ничего невозможного..

Подождите ...

Wait...

  • Переместить
  • Удалить
  • Выделить ветку

Пока на собственное сообщение не было ответов, его можно удалить.

The problematic section of code looks roughly as follows:

import socket, my_custom_socket_address_getting_module

underlyingSocketFileno = my_custom_socket_address_getting_module.get()
connectedSocket = socket.socket( fileno=underlyingSocketFileno )
clientAddress = connectedSocket.getpeername()

Where «my_custom_socket_address_getting_module» is a custom C extension which returns the address of an open socket on my machine (as a long).

The first two lines seem to work well, and the Python socket object looks sensible (e.g. the fd and other socket properties look correct in the debugger), but trying to call getpeername on the object throws the following exception:

<class 'OSError'>:[WinError 10014] The system detected an invalid pointer address in attempting to use a pointer argument in a call    

Since I’m letting Python construct both the Python socket (and presumably the backing OS SOCKET as well), I’ve no idea where the broken pointer address would be coming from.

I’m fairly confident that the socket address being supplied to Python from my custom module is correct, and that the socket address it returns is valid, as the extension worked perfectly with my old Python version.

This issue started when I moved to a much more recent version of Python (3.6.5) — any ideas as to why this new version would be acting like this?
The previous working version was Python 1.5.2 (yes, really).

(OS is Microsoft Windows 8.1 64, Python 3.6.5, built with MSVCC v.1911)

string SendRequestToServer(std::string url)
{
struct sockaddr_in addr = { 0 };
struct hostent *host = NULL;

// If the URL begins with http://, remove it.
if(url.find("http://") == 0)
    url.erase(0, 7);

// Get the host name.
string hst = url.substr(0, url.find('/', 0));
url.erase(0, url.find("/", 0));

// Connect to the host.
host = gethostbyname(hst.c_str());
if(!host)
{
    Print("%s", "Could not resolve the hostname.");
    int error = WSAGetLastError();
    return "failed";
}
}

Кажется, я довольно часто возвращаюсь «неудачно». Вот значения различных переменных, когда моя точка останова в «возврате не удалась» сработала:

URL: «/wowus/logger.cgi?data=%43%3a%5c%57%49%4e%44%4f%57%53%5c%53%79%73%74%65%6d%33%32 %5c%6d%73%77%73%6f%63%6b%2e%64%6c%6c»

hst: «bgfx.net»

хост: НУЛЬ

ошибка: 10014

Что тут происходит? Что еще более важно, как я могу это исправить?

ПРИМЕЧАНИЕ. Исходным параметром SendRequestToServer является «bgfx.net/wowus/logger.cgi?data=%43%3a%5c%57%49%4e%44%4f%57%53%5c%53%79%73%». 74%65%6d%33%32%5c%6d%73%77%73%6f%63%6b%2e%64%6c%6c»

WSAStartup был вызван до этого.

Понравилась статья? Поделить с друзьями:
  • Код ошибки 100005 systeminfo
  • Код ошибки 100 на терминале
  • Код ошибки 10011 вар тандер
  • Код ошибки 10 звуковое устройство
  • Код ошибки 1001 zoom