[ENet-discuss] Differentiating multiple peer clients from same remote machines

David Lethe david at santools.com
Mon May 18 22:45:24 PDT 2009


I've progressed to the point where ENET is communicating between a client and server, but I am having problems understanding how to properly identify multiple peers running on the same remote server.

Specifically, my design calls for a threaded server to manage multiple jobs running on remote hosts.  Each job is a separate entity, and is kicked off by the enet server.  I need to keep track of them separately, as they provide status information to the host as they run, and the host provides additional instructions as necessary.  

I am already adding information in the packet that contains a unique job number and ID string that is passed to the remote host when the job kicks off, so this insures that when/if the enet server goes down, it can be restarted and the running jobs can re-establish themselves.

So, how do I properly identify the individual peers running on the remote systems when I get an ENET_EVENT_TYPE_CONNECT, and use the 
The host is bound to ENET_HOST_ANY, at UDP port #4079.  

I have no problems enumerating the ENetPeer structure and checking against duplicate ids, but since each job has the same host & port, then I don't know best way to handle this?

Do I give each job a unique channel number?  Or is the peer.sessionID going to always be unique and constant until the connection is closed?  The outgoingPeerID & incomingPeerID are zero when the peer tries to connect, so they aren't of any use.

The other issue I have is I would like to use the enet_list_* functions because they are a little more elegant than maintaining a array, but I need a little help using it as I am using C, not C++ and would love to see how to learn this technique.

for (;;) {
  if (enet_host_service(server,&event,1000) > 0) {
    switch (event.type) {
      case ENET_EVENT_TYPE_CONNECT:
         index= FindPeerIndex( 

Thanks
david @ santoolsDOTcom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3744 bytes
Desc: not available
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20090519/5648a66a/attachment.bin>


More information about the ENet-discuss mailing list