3

I'm creating a board game to be played via wi-fi, in the iPhone.

When device A invites device B to play(try to resolve the NSNetService published by B), device B can accept or decline.

If B declines, A is notified and everything is fine. But if A try to invite B again later, i get the following error in my netService:didNotResolve: delegate method.

NSNetServicesErrorCode = -72003 NSNetServicesErrorDomain = 10

The error -72003 means NSNetServicesActivityInProgress...How can i proceed to let one player "invite" other player more than once ?

I'm using the AsynchSocket libray, thanks!

Fernando
  • 7,785
  • 6
  • 49
  • 81
  • Post some of your code to illustrate what you are currently doing – Nick Bull Jul 01 '11 at 08:29
  • When the browser find a new service, i add it to the array and call [service resolveWithTimeout:]. When netServiceDidResolveAddress: is called, i connect my socket to this new service using [self.socket connectToAddress:error:]...When the user touches a row of my tableView, i grab the service from the array and call again [self.socket connectToAddress:error:]...it works now, but i think i have to connect only when the user request...am i right? – Fernando Jul 01 '11 at 22:18

2 Answers2

2

Ok, i figure that out.

What i'm doing is to resolve the NSNetService as quick as possible in the browserDidFind: delegate method. When a need to connect i call [socket connectToAddress:], passing the NSNetService address, no more errors!

thanks!

Fernando
  • 7,785
  • 6
  • 49
  • 81
1

Before [service resolveWithTimeout:] call [service stop]