|
|
Classification: |
C++ |
Category: |
Comms |
Created: |
01/03/2001 |
Modified: |
08/24/2001 |
Number: |
FAQ-0548 |
Platform: |
ER5 |
|
Question: I make a call to RSocketServ::NumProtocols to get the number of loaded protocols. I then call GetProtocolInfo() in a loop
to get information on each of the protocols. My app is freezing on the very first iteration at index 0. What's happening?
Answer: The Indexes for the protocols start a 1 not 0. So if there are 7 loaded protocols the index numbers go from 1 to 7 not 0 to
6 as you might think. Here is a section of code. All the error checking has been removed for easy of reading. ss is the socket
server:
TUint numProtocols; User::LeaveIfError(ss.NumProtocols(numProtocols));
for(TUint i=1; i <= numProtocols; i++) { TProtocolDesc protoInfo; User::LeaveIfError(ss.GetProtocolInfo(i,protoInfo)); console.Printf(_L("Protocol %d, Name is %s, Version is %s\n"), i, protoInfo.iName.PtrZ(), protoInfo.iVersion.Name().PtrZ()); }
|
|
|