I create listen bluetooth socket and regisry it as service:


// load protocol, RFCOMM
TProtocolDesc pdesc;
User::LeaveIfError(iSocketServ->FindProtocol(_L("RFCOMM"), pdesc));

// open a socket
iListenSock.Open(*iSocketServ,pdesc.iAddrFamily,pdesc.iSockType,KRFCOMM);

// get listening channel
TInt channel;
User::LeaveIfError(iListenSock.GetOpt(KRFCOMMGetAvailableServerChannel, KSolBtRFCOMM, channel));

btsockaddr.SetPort(channel);

// bind socket
User::LeaveIfError(iListenSock.Bind(btsockaddr));
// listen on port
User::LeaveIfError(iListenSock.Listen(5));

// set channel security
TRequestStatus status;
RBTMan secManager;
RBTSecuritySettings secDatabase;
TBTServiceSecurity secSettings;
// connect to security manager
User::LeaveIfError(secManager.Connect());
CleanupClosePushL(secManager);
User::LeaveIfError(secDatabase.Open(secManager));
CleanupClosePushL(secDatabase);
// setup security
TUid settingsUID;
settingsUID.iUid = KSerialPortService;
secSettings.SetUid(settingsUID);
secSettings.SetChannelID(channel);
secSettings.SetProtocolID(KRFCOMM);
secSettings.SetAuthentication(ETrue);
secSettings.SetAuthorisation(ETrue);
secSettings.SetEncryption(EFalse);
secSettings.SetDenied(EFalse);
// register settings with security
secDatabase.RegisterService(secSettings, status);
User::WaitForRequest(status);
CleanupStack::PopAndDestroy(); // secManager
CleanupStack::PopAndDestroy(); // secSettings

// open blank socket and pass it to accept to be assigned a proper
// socket upon completion of Accept()
User::LeaveIfError(iSock.Open(*iSocketServ));

// set to accept incoming connections, active object will handle
iListenSock.Accept(iSock,iStatus);


Then I try discovery this service on PC, but unsuccessfully.
Though at the same time I can connect to this socket.
That may be wrong? Any adeas please.
-------------------------------------
Sergei Ivanov from Russia