03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

User::LeaveIfError(<br />

readSock.Open(iReceiver.iResMan.SocketServer()));<br />

// Tell socket we'll accept an incoming connection...<br />

iReceiver.iListenSocket.Accept(readSock, iReceiver.iStatus);<br />

// ...and wait<br />

iReceiver.SetActive();<br />

}<br />

In the sockets API, Listen() simply queues incoming connections. In<br />

TAcceptState::EnterL(), we create a new socket that will accept one of the queued<br />

incoming connections. When this happens, we are ready to read our GDP data packet.<br />

CGdpStateMachine::TState* CGdpBTReceiver::TAcceptState::CompleteL()<br />

{<br />

// Got an incoming connection!<br />

// Where'd it come from?<br />

TL2CAPSockAddr sockAddr;<br />

iReceiver.iReadSocket.RemoteName(sockAddr);<br />

// Convert and store as hex in the remote address descriptor<br />

TBTDevAddr remAddr = sockAddr.BTAddr();<br />

iReceiver.iRemAddr.Zero(); // Set length to zero<br />

for (TInt i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!