Problem in code with HandleInput?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Problem in code with HandleInput?

      Maybe its a bug in my network code, but I had a problem with yer HandleInput functions not being called...

      under NetSocket I have to do a NetSocketPtr->GetCast<...> before calling each NetSocket's HandleInput(), because otherwise itll only call the parent's HandleInput()...

      If you go look under BaseSocketManager.DoSelect(), where it has:
      ----------------------------------------------------------------------
      if (selRet)
      {
      for (SocketList::iterator i = m_SockList.begin(); i != m_SockList.end(); ++i)
      {
      pSock = *i;

      if ((pSock->m_deleteFlag&1) || pSock->m_sock == INVALID_SOCKET)
      continue;

      if (FD_ISSET(pSock->m_sock, &exc_set))
      {
      pSock->HandleException();
      }

      if (!(pSock->m_deleteFlag&1) && FD_ISSET(pSock->m_sock, &out_set))
      {
      pSock->HandleOutput();
      }

      if ( handleInput
      && !(pSock->m_deleteFlag&1) && FD_ISSET(pSock->m_sock, &inp_set))
      {
      pSock->HandleInput();
      }
      }
      }
      --------------------------------------------------------------------------

      we need a pSock->GetCast<...> before calling HandleInput() to make sure it is called under each inheritance correctly right? Maybe I missed something, ill look some more, but from what I can tell so far this should be the problem.



      Next note, after I get the correct call under NetListenSocket->HandleInput() and AcceptConnection is ran, I am getting an error back from the accept(..) call as WSAENOTSOCK. I think there is an error somewhere in here as well that im looking into.


      Question is, has any1 actually ran a connection yet using this code?

      Thanks,
      Brad
    • I went ahead and checked that second part, the connection is fine... I was putting the wrong SOCKET AcceptConnection(), I needed the listen socket which was used with SOCKET.listen()... duhh...

      But the GetCast problem earlier did work for me after changing it in my game code... but I think the GameCodingComplete code base needs updated there with it... or if you have an easier way of making sure each HandleInput is called correctly, I would be happy to know it... like a generic way, instead of having to do,
      if(type == ...), else if(type == ...), else().


      EDIT: You know what I just realized mike, you didnt use Shared_Ptr for this.... I happen to do it in my code, so this might not be a problem within yer code base.

      The post was edited 1 time, last by xsirxx ().

    • RE: Problem in code with HandleInput?

      are there no problems in the main source? or is it about dead by now? I dont have the time right now to "revive" the code...

      I just had such a learnings expierence with this book that I wish others could learn too. Everytime I have an issue with my code as far as trying to understand what next to jump to, I look at "the book". And it helps relax me back to the point I was trying to achieve.

      So not to sound like an ass, or a snob, but please reply for further achievements we can expect out of any1 who takes notice of this book and code. AND, so we can dispell those stupid statements on amazon.com. "GameCodingComplete"2nd Edition, has helped me....

      For a later story...

      EDIT: btw, I suck at spelling....

      The post was edited 1 time, last by xsirxx ().

    • ?
      A lot of us were at GDC this past week and just got back.

      I did succeed in getting the network code to work between two machines, so the main source works for me as far as I can tell. There was a little issue that went away when I turned off the firewall.

      What exactly is your question? Is what dead, by now?
    • Originally posted by Kain

      What exactly is your question? Is what dead, by now?


      Ahh I forgot about GDC being this week(well forgot that the programmers in programming forums would be there) :).

      The question was if the code was still being updated, I know 2.2 came out, but it seemed that the responses were slowing down... but of course that could have been because of GDC... so I guess the question is kinda mute now...

      And the other question about if any1 had the networking code working was to see if the problem I had(which I replaced the pointers to safe pointers) was the same in the original code(2.2)... But I suspose not... :).

      Thanks for the reply anyhow.