GNet suggestion
BlitzMax Forums/BlitzMax Module Tweaks/GNet suggestion
| ||
Hi, This is a small change to GNet that I think should make it's way into the official version. It's in the TGNetHost type: Method Connect( ip,port,timeout,peers,inband,outband ) If Not _enetHost _enetHost=enet_host_create( Null,peers,inband,outband ) If Not _enetHost Return EndIf Local addr:Byte Ptr=enet_address_create( ip,port ) Local peer:Byte Ptr=enet_host_connect( _enetHost,addr,1 ) enet_address_destroy addr If Not peer Return timeout:+MilliSecs() While timeout-MilliSecs()>0 UpdateENetEvents For Local ev:ENetEvent=EachIn _enetEvents If ev.event=ENET_EVENT_TYPE_CONNECT And ev.peer=peer _enetEvents.Remove ev AddPeer peer Return True EndIf Next Wend End Method It would allow the programmer to specify how many peers that can connect to the game. GNet is always using 32 at the moment. inband/outband is used to set the upstream/downstream bandwith. (the default 0 will alow "unlimited" upstream/downstream) This also means that GNetConnect should be changed too: Function GNetConnect( host:TGNetHost,address$,port,timeout_ms=10000,peers=32,inband=0,outband=0 ) Return host.Connect( HostIp(address),port,timeout_ms,peers,inband,outband ) End Function Nothing big. Just a little change to give the programmer a little more control. |