8

I'm trying to create an iPhone app that will run in the background and uses Raknet transfer data between a client and a server. I followed a tutorial to get a simple chat client and server running.

I want the app to be notified of incoming data when running in the background, but it looks like I have to use CFStreams for the data instead of the sockets that RakNet creates. Is there a way to do this?

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    mRakPeer  = RakPeerInterface::GetInstance();
    mClientID = UNASSIGNED_SYSTEM_ADDRESS;

    SocketDescriptor socketDescriptor(54001,0);
    socketDescriptor.socketFamily=AF_INET;

    mRakPeer->Startup(8,&socketDescriptor, 1);
    mRakPeer->SetOccasionalPing(true);  

    ConnectionAttemptResult car = mRakPeer->Connect("192.168.1.3", 54000, "Rumpelstiltskin", (int) strlen("Rumpelstiltskin"));

    RakAssert(car==RakNet::CONNECTION_ATTEMPT_STARTED);
 }
izb
  • 50,101
  • 39
  • 117
  • 168
Nathan.Arnold
  • 188
  • 1
  • 7
  • Can you start the connection using CFStream, then use a combination of `dup2` to duplicate the file descriptor returned by `kCFStreamPropertySocketNativeHandle`, and then send that to RakNet to use as its connection? – Richard J. Ross III Jul 01 '15 at 22:49
  • @RichardJ.RossIII Maybe http://www.raknet.com/forum/index.php?topic=2669.0 – jmasterx Jul 01 '15 at 23:06
  • If more bounty is needed, that can be arranged through another question. – jmasterx Jul 02 '15 at 13:48
  • 1
    Someone please at least give a basic answer otherwise the bounty will go to waste :( – jmasterx Jul 03 '15 at 18:50

0 Answers0