[ENet-discuss] Tracking Clients [Was: Re: Tracking Connections]
Beau Albiston
albiston at cynergy.com
Sun Aug 29 12:08:52 PDT 2010
There are more than a few ways of doing this. Assuming the
event->peer pointer provided by the connect event doesn't change, you
can keep a hash table of these peer pointers. To distinguish clients,
create some sort of hash map: <key> to peer. To get a client: peer =
get_client(<key>). The key is application/protocol specific.
Like I said, there are a number of ways in which to accomplish this same
task...
-Beau
On 8/28/10 10:09 AM, Nicholas J Ingrassellino wrote:
> What about tracking clients? I am unclear about how to tell who is who.
>
> ------------------------------------------------------------------------
>
> Nicholas J Ingrassellino
> LifebloodNetworks.com <http://www.lifebloodnetworks.com/> ||
> nick at lifebloodnetworks.com <mailto:nick at lifebloodnetworks.com>
>
> "The idea that I can be presented with a problem, set out to logically
> solve it with the tools at hand, and wind up with a program that could
> not be legally used because someone else followed the same logical
> steps some years ago and filed for a patent on it is horrifying."
> - John Carmack on software patents
>
>
> On 08/26/2010 07:35 PM, Lee Salzman wrote:
>> ENET_PACKET_FLAG_RELIABLE is for reliable and sequenced, there is no
>> way to get reliability without sequencing in ENet.
>> ENET_PACKET_FLAG_UNSEQUENCED is for unreliable and unsequenced
>> currently. It gets ignored if reliable is used.
>> If you simply pass in neither of these flags, you get UNreliable and
>> unsequenced, i.e. pass in 0 for the flags.
>>
>> These flags are passed in to enet_packet_create(), which determines
>> the type of packet.
>>
>> Lee
>>
>> On 08/26/2010 02:26 PM, Nicholas J Ingrassellino wrote:
>>> I am pretty new to the *ENet* library (and network programming in
>>> general). I have done a few test games with *HawkNL* but that is
>>> about all and was at least one year ago.
>>>
>>> With the help of the *ENet* tutorial on the site I have built a
>>> server and client that can pass data back and forth (I was so
>>> happy). The tutorial, however, has left at least two things unclear
>>> to me:
>>>
>>> 1. How can I send data reliably but unsequenced? How can I send
>>> data unreliably but sequenced?
>>> 2. How can I track connections when more than one client is
>>> connected?
>>>
>>> I know there are /ENET_PACKET_FLAG_RELIABLE/ and
>>> /ENET_PACKET_FLAG_UNSEQUENCED/ via the headers. The tutorial does
>>> not when mention /ENET_PACKET_FLAG_UNSEQUENCED/ nor its expected
>>> behavior so I am left to assume. Judging by the variable names I
>>> think these are meant to be used in bit flags? I have also noticed
>>> that /ENetEvent->peer/ has a few members that might be what I am
>>> looking for when tracking connections (/outgoingPeerID/,
>>> /incomingPeerID/, /connectID/, /outgoingSessionID/,
>>> /incomingSessionID/) but I am unclear on which of these to use if any.
>>>
>>> ------------------------------------------------------------------------
>>>
>>> Nicholas J Ingrassellino
>>>
>>>
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
More information about the ENet-discuss
mailing list