3

So I have started using Enet and I really like it but I was doing some testing sending information from a client to a server ( 60 times per second) and the server was successfully receiving these packets ( 60 times per second) and all was going well until randomly the server stops receiving packets.

After further testing I found out that the client is sending a disconnect packet, I am not sure why. If anyone has any knowledge of Enet that could help me out it would be greatly appreciated. Only thing I can currently think of is that the client is timing out.

Okay so 4:30 AM is the explanation behind this issue. With my last awake braincell I noticed a line of code with the an argument of 5000 ms, because I'm calling my code 60 times every minute and it was timing out at about 30 seconds or so it was because I had a line of code in the wrong spot... Lesson learned, don't post questions on stackoverflow after midnight...

  • I'm not sure how to delete posts this was kind of useless
1
  • 2
    You could always answer the question yourself and accept the answer, showing what you did. This is good practice as it shows others what you did in a more clear fashion than including the answer in your question :) Commented Jan 11, 2011 at 10:57

1 Answer 1

3

I ran into this problem recently too, and the solution is that both hosts (client and server) need to call enet_host_service regularly, otherwise the other end will time out as if a disconnect was sent.

This is because some sample client/server code floating around doesn't bother calling enet_host_service in the client.

enet_host_service does a bit of housekeeping, making sure that both sides are aware that the other end is alive and so on.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.