Implementing "accept" in Bluetooth / Linux ?
-
Could some kind person help me to analyze this code ?
It is a modification of
http://people.csail.mit.edu/albert/bluez-intro/
I have few basic concerns
-
I am not sure how “client” server gels included in the FULL implementation.
The resource , and many “free source code “ copies of it do not include the actual
FULL implementations. -
I am not sure How EACH USAGE OF “so9cket” interacts.
3, My code sort of works until
//client = accept(server_socket, (struct sockaddr *)&rem_addr, &opt);
When the above code is uncommented the code execution (in debug mode ) STOPS at that line.
I have no reasonable description of the “”accept” function and NOT KNOW how to debug / step thru it – it is “bluez ?” library code.
'I am not sure if "server_socket" belongs to this function...
Part of code :
//HERE // temporary initialize client to fail code client = -1; // select SPC\_CA //rem\_addr = "01:23:45:67:89:AB"; // ,SPP\_C\_addr\[19\]; // accept one connection // verify passed paramaters ?? text = "verify server\_socket "; text += QString ::number(server\_socket); text += Q\_FUNC\_INFO; text += " @ line "; text += QString::number(\_\_LINE\_\_); qDebug() << text;
#ifdef BYPASS
text = " (struct sockaddr *)&rem_addr ";
//text += QString ::number(server_socket);
//text += rem_addr.rc_bdaddr.toString();
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
qDebug() << text;
#endif//client = accept(server\_socket, (struct sockaddr \*)&rem\_addr, &opt); text = "verify server\_socket "; text += QString ::number(server\_socket); text += Q\_FUNC\_INFO; text += " @ line "; text += QString::number(\_\_LINE\_\_); qDebug() << text; if(client < 0 ) {
//#ifdef C_CODE_TRACE
text = " FAILED accept one connection";
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
text += " client ";
text += QString::number(client );qDebug() << text;
//#endif
} else {
#ifdef C_CODE_TRACE
text = "SUCCESS accept one connection";
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
text += " client ";
text += QString::number(client );qDebug() << text;
#endif} ba2str( &rem\_addr.rc\_bdaddr, buf ); fprintf(stderr, "Verify accepted rem address connection f
-