Bonjour,
Je réalise un logiciel client/serveur sous windows je souhaite utiliser les fonction WSA. Jusque la pas de soucis, tout fonctionne bien. Mon souci interviens lorsque je souhaite envoyer un int via WSASend(), l'envoi échoue et je reçois l'erreur suivante:
10014 (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. )
le pointeur me semble correct et du coup après avoir pas mal chercher/tester je suis bloqué. Je n'ai ce problème qu'avec des int.
voici la fonction en question:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| void envoi_int(int fd, int d)
{
WSABUF DataBuf;
DWORD SendBytes;
int i;
DataBuf.buf = (char *) d;
DataBuf.len = sizeof(int);
if ((i = WSASend(fd, &DataBuf, 1, &SendBytes, MSG_OOB, 0, NULL)) != 0)
{
i = WSAGetLastError();
std::cout << "error :" << i << std::endl;
}
} |
Partager