/* if we fail, call ourself to find out why and return that error */
int _tmain(int argc, _TCHAR* argv)
WORD wVersionRequested = 0x202;
if (0 == WSAStartup(wVersionRequested, &m_data))
SOCKET s = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
const DWORD lastError = ::GetLastError();
if (s == INVALID_SOCKET)
printf("Failed to get bluetooth socket! %s\n", GetLastErrorMessage(lastError));
Re: Bluetooth socket not receiving data sent from client.
Agreement with VictorN about the need to edit your post.
Originally Posted by VijayDandur
My issue is , Bluetooth server running on PC, is not receiving data sent from clients, but connection establishment is successful.
What I mean is, after executing "recv(s2,(char*)buffer, sizeof(buffer), 0);" function call, the server is blocked indefinitely.
How have you confirmed that the client is indeed sending data? The behavior you are seeing on the server side is completely consistent with a non-communicative client who, after establishing a connection, has not bothered to send any data.
So, please explain how you have confirmed that the client is sending something.
Perhaps post the client code, but I have a suspicion that (as in your other post) you have not written any client code but are instead relying on some "built-in" behavior of the client (a phone, I think).