c++ Winsock problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Adam01
    New Member
    • Aug 2008
    • 83

    c++ Winsock problem

    Hi,
    I've been getting this problem when after a certain ammount of sent messages to the server, the client would freeze up. And the only way to un-freeze the client would be to close the socket via the server.

    I'm making a server for a simple 2d game (which I didnt make) and it uses sdl_net.
    Before I post all the source code, does anyone reconise these sort of problems?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Yes I have heard of this and, IIRC, you need to create your sockets with the SO_KEEPALIVE option otherwise the intervening routers ultimately close the link after a while.

    Comment

    • Adam01
      New Member
      • Aug 2008
      • 83

      #3
      Ok, would this need to be set on the client as well?
      I applied the setting on the server, but I get the same result.
      I used this:
      setsockopt(List enSocket, SOL_SOCKET, SO_KEEPALIVE, (char*)&bOptVal , bOptLen)

      If I did need to set on the client, how can I apply this with sdl_net?

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Erm you probably do need to apply this to the client, however I have absolutely no experience with sdl_net.

        Comment

        • Adam01
          New Member
          • Aug 2008
          • 83

          #5
          Ok, thanks for your help.
          But the client still freezes up, even on localhost.
          Could there be anything else, say if there was a problem with recv or something?

          Comment

          • Adam01
            New Member
            • Aug 2008
            • 83

            #6
            Could their be anything else that causes the crash?

            Comment

            • Adam01
              New Member
              • Aug 2008
              • 83

              #7
              Common, Im running out of excuses to bump.

              Comment

              Working...