Need some help with ENet

BlitzMax Forums/BlitzMax Programming/Need some help with ENet

Tibit(Posted 2006) [#1]
Have anyone any experience with ENet?

It is a mess everything is Byte Pointers. What am I supposed to do with them? I want the data as a string or a array of bytes.

If anyone can or have worked this out it would be greatly appriciated. Or do I have to use GNet to use ENet. I guess the ENet module isn't meant to be used by others. Atleast it is great that the source is open, to bad it is encrypted ;)

ENet_initialize()
Global EventList:TList = CreateList()

'Host a Server:
Global Host:Byte Ptr
Host = ENet_host_create( enet_address_create( HostIp(IP$),port ), peerCount, incBandwidth, outBandwidth)

'IP$ is the IP in the String form, ex IP$ = "127.0.0.1"
'Port is the port number you want To host on, this is what others connect To, ex port = 8000
'peerCount is maximum number of players allowed.
'IncBandwidth is the maximum Incoming bandwidth ENet is allowed To use. 
'OutBandwidth is the maximum Outgoing bandwidth ENet is allowed To use.

While Not KeyDown( Key_Escape )

Local Event:ENetEvent = New ENetEvent
Local Timeout = 0
'Checks for new events
ENet_host_service( Host,Event,timeout )
'Now you can put the Event in a list Or so.
Select Event.Event

 Case ENET_EVENT_TYPE_CONNECT
 
 Case ENET_EVENT_TYPE_RECEIVE
            Event.packet
            Event.peer
            Event.channelID
 
 
 Case ENET_EVENT_TYPE_DISCONNECT

EndSelect

Wend



deps(Posted 2006) [#2]
No one got anything? All those byte pointers makes things a bit more confusing and I would most likely create millions of small memory leaks.

A short tutorial or a wrapper that makes it a bit more easy to use would be nice, if someone got the time and knowledge.