ENet peer functions


Functions

void enet_peer_throttle_configure (ENetPeer *peer, enet_uint32 interval, enet_uint32 acceleration, enet_uint32 deceleration)
 Configures throttle parameter for a peer.
int enet_peer_throttle (ENetPeer *peer, enet_uint32 rtt)
int enet_peer_send (ENetPeer *peer, enet_uint8 channelID, ENetPacket *packet)
 Queues a packet to be sent.
ENetPacketenet_peer_receive (ENetPeer *peer, enet_uint8 channelID)
 Attempts to dequeue any incoming queued packet.
void enet_peer_reset_queues (ENetPeer *peer)
void enet_peer_reset (ENetPeer *peer)
 Forcefully disconnects a peer.
void enet_peer_ping (ENetPeer *peer)
 Sends a ping request to a peer.
void enet_peer_disconnect_now (ENetPeer *peer, enet_uint32 data)
 Force an immediate disconnection from a peer.
void enet_peer_disconnect (ENetPeer *peer, enet_uint32 data)
 Request a disconnection from a peer.
void enet_peer_disconnect_later (ENetPeer *peer, enet_uint32 data)
 Request a disconnection from a peer, but only after all queued outgoing packets are sent.
ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *peer, const ENetProtocol *command, enet_uint16 sentTime)
ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *peer, const ENetProtocol *command, ENetPacket *packet, enet_uint32 offset, enet_uint16 length)
ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *peer, const ENetProtocol *command, ENetPacket *packet, enet_uint32 fragmentCount)


Function Documentation

void enet_peer_disconnect ( ENetPeer peer,
enet_uint32  data 
)

Parameters:
peer peer to request a disconnection
data data describing the disconnection
Remarks:
An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() once the disconnection is complete.

void enet_peer_disconnect_later ( ENetPeer peer,
enet_uint32  data 
)

Parameters:
peer peer to request a disconnection
data data describing the disconnection
Remarks:
An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() once the disconnection is complete.

void enet_peer_disconnect_now ( ENetPeer peer,
enet_uint32  data 
)

Parameters:
peer peer to disconnect
data data describing the disconnection
Remarks:
No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not guarenteed to receive the disconnect notification, and is reset immediately upon return from this function.

void enet_peer_ping ( ENetPeer peer  ) 

Parameters:
peer destination for the ping request
Remarks:
ping requests factor into the mean round trip time as designated by the roundTripTime field in the ENetPeer structure. Enet automatically pings all connected peers at regular intervals, however, this function may be called to ensure more frequent ping requests.

ENetPacket* enet_peer_receive ( ENetPeer peer,
enet_uint8  channelID 
)

Parameters:
peer peer to dequeue packets from
channelID channel on which to receive
Returns:
a pointer to the packet, or NULL if there are no available incoming queued packets

void enet_peer_reset ( ENetPeer peer  ) 

Parameters:
peer peer to forcefully disconnect
Remarks:
The foreign host represented by the peer is not notified of the disconnection and will timeout on its connection to the local host.

int enet_peer_send ( ENetPeer peer,
enet_uint8  channelID,
ENetPacket packet 
)

Parameters:
peer destination for the packet
channelID channel on which to send
packet packet to send
Return values:
0 on success
< 0 on failure

void enet_peer_throttle_configure ( ENetPeer peer,
enet_uint32  interval,
enet_uint32  acceleration,
enet_uint32  deceleration 
)

Unreliable packets are dropped by ENet in response to the varying conditions of the Internet connection to the peer. The throttle represents a probability that an unreliable packet should not be dropped and thus sent by ENet to the peer. The lowest mean round trip time from the sending of a reliable packet to the receipt of its acknowledgement is measured over an amount of time specified by the interval parameter in milliseconds. If a measured round trip time happens to be significantly less than the mean round trip time measured over the interval, then the throttle probability is increased to allow more traffic by an amount specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. If a measured round trip time happens to be significantly greater than the mean round trip time measured over the interval, then the throttle probability is decreased to limit traffic by an amount specified in the deceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has a value of ENET_PEER_PACKET_THROTTLE_SCALE, on unreliable packets are dropped by ENet, and so 100% of all unreliable packets will be sent. When the throttle has a value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable packets will be sent. Intermediate values for the throttle represent intermediate probabilities between 0% and 100% of unreliable packets being sent. The bandwidth limits of the local and foreign hosts are taken into account to determine a sensible limit for the throttle probability above which it should not raise even in the best of conditions.

Parameters:
peer peer to configure
interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL.
acceleration rate at which to increase the throttle probability as mean RTT declines
deceleration rate at which to decrease the throttle probability as mean RTT increases


Generated on Wed Jun 6 14:33:50 2007 for enet by  doxygen 1.5.1