Hi!

I'm writing a new software project, and am using enet for part of the transport 
protocol, and had a few questions.

The biggest question I have is how to use enet in a select-based (or, more 
likely, epoll-based) loop: waiting for events via an interface like epoll, and 
on activity, drive the enet connections.

Now, it makes sense that I can run a selection on a ENetHost's socket for 
readability, and invoke enet_host_service then. What I'm missing, though, is 
when to call enet_host_service for writable events: I assume, from looking a 
bit at the code, that enet_host_service needs to be called regularly to 
dispatch both incoming and outgoing messages, but I don't think you want to 
call enet_host_service on *every* writable event, if there is nothing going 
out, because that would lead to a busy-loop, which I want to avoid (the idea 
here is that I would call enet_host_service with a very small timeout, probably 
zero). Is there a way to tell from an ENetHost or a bunch of ENetPeers whether 
or not there is pending outgoing messages?

The short answer to why I want to do this is because I want to write an addon 
for Node that wraps enet, and Node has its fairly specific way of doing things. 
I suppose this can also be accomplished by doing the enet service calls in a 
separate thread, but I was hoping to avoid that.

A related question is how many simultaneous peers can enet support? 100? 1,000? 
10,000?

And lastly, any idea what the behavior should be for a "simultaneous connect"? 
That is, two peers attempt to connect to one another at the same time, on the 
same ports? Would the ENetPeer objects returned by enet_host_connect both be 
valid?

Thanks!
_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss

Reply via email to