I'm connecting to a bluetooth socket like so,
SOCKET s = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
SOCKADDR_BTH bthSockAddr;
bthSockAddr.btAddr = addr;
bthSockAddr.addressFamily = AF_BTH;
bthSockAddr.port = BT_PORT_ANY;
bthSockAddr.serviceClassId = SerialPortServiceClass_UUID;
if ( 0==connect( sOut, (sockaddr*)&bthSockAddr,sizeof(bthSockAddr)) )
{
printf( "connect success\n" );
T data;
int size = sizeof(T);
int optname = ... ;
if ( 0!=getsockopt( s, 0, optname, (char*)&data, &size ) )
{
// getsockopt failed
}
}
The connections succeeds, but getsockopt seems to fail for all optname/T pairs that I try (e.g. optname==SO_DEBUG, T==BOOL ). Does getsockopt just make no sense in this context? Have tried each of,
SO_ACCEPTCONN, SO_BROADCAST, SO_CONDITIONAL_ACCEPT,
SO_DEBUG, SO_DONTLINGER, SO_DONTROUTE, SO_EXCLUSIVEADDRUSE,
SO_KEEPALIVE, SO_OOBINLINE, SO_REUSEADDR, SO_ERROR,
SO_GROUP_PRIORITY, SO_RCVBUF, SO_SNDBUF, SO_TYPE, SO_MAX_MSG_SIZE
with their appropriate types. I'm aware not all option always apply, but can't find a list of what does apply for my socket type.
Context -- I'm trying to write a platform independent API for a bluetooth connection and want to dump debug info for the socket.