I haven't added any new features from the previous release, because right now it works (should work). And some of the new stuff might create bugs. Anyhow the biggest addition is that now TNet should not suffer from the Flushmem error! From my tests it works find to send over 1000 upd messages at once (LAN).
The TNet website (Go here to download and get more information)
To test the example below you must first Install the new TNet.
Open a new Blitzmax application and paste this code. Build and Run. Your server is running.
Open a new instance of blitzmax and paste the code below. Build and run and your first client has joined your server. Run more instances of this to let more clients join your server.
If you get any errors please report them.
The TNet website (Go here to download and get more information)
To test the example below you must first Install the new TNet.
Open a new Blitzmax application and paste this code. Build and Run. Your server is running.
Graphics 300,300,0 'TNet_Debug_Host = True 'TNet_Debug_Send = True 'TNet_Debug_Receive = True TNet_HostTCP( 8080 ) 'TNet_HostUDP( 8080 ) TNet_SetDisconnectTime( 10 )'sec LastMSG$ = "No Message Received Yet" While Not KeyHit(KEY_ESCAPE) TNet_Update() DrawText "I'm the Host!",0,0 DrawText "CHAT: [ "+LastMSG+" ] ",0,18 DrawText "MsgReceived: "+TNet.MsgReceivedCount,0,36 TNet_DrawClientList(10,75) If KeyHit(Key_T) TNet_SendTCP( 1, "TCP" ) 'To ALL If KeyDown(Key_R) TNet_SendTCP( 1, "STRESS TCP" ) 'To ALL If KeyHit(Key_U) TNet_SendUDP( 1, "UDP" ) 'To ALL If KeyDown(Key_Y) TNet_SendUDP( 1, "STRESS UDP" ) 'To ALL If KeyHit(Key_N) For N = 1 To 1000 TNet_SendUDP( 1, "UDP" ) 'To ALL Next EndIf If KeyHit(Key_M) For N = 1 To 1000 TNet_SendTCP( 1, "TCP" ) 'To ALL Next EndIf If TNet_Receive(1) LastMSG = TNetData DrawRect X,280,30,5 X:+7 If X > 320 X = -20 Flip;Cls Wend
Open a new instance of blitzmax and paste the code below. Build and run and your first client has joined your server. Run more instances of this to let more clients join your server.
SetGraphicsDriver GLMax2DDriver() Graphics 300,300,0 Local ip$ = "127.0.0.1"' Replace with your IP 'TNet_Debug_Join = True 'TNet_Debug_Send = True 'TNet_Debug_Receive = True If Not TNet_JoinTCP( ip,8080) RuntimeError "Cannot Connect" 'If Not JoinUDP( ip,8080 ) RuntimeError "Cannot Connect" TNet_SetDisconnectTime( 10 ) LastMSG$ = "No Message Received Yet" While Not KeyHit(KEY_ESCAPE) TNet_Update() DrawText "I'm Client "+TNetMy.Net_ID,0,0 DrawText "CHAT: [ "+LastMSG+" ] ",0,18 DrawText "MsgReceived: "+TNet.MsgReceivedCount,0,36 TNet_DrawClientList(10,75) If KeyHit(Key_T) TNet_SendTCP( 1, "TCP" ) 'To ALL If KeyDown(Key_R) TNet_SendTCP( 1, "STRESS TCP" ) 'To ALL If KeyHit(Key_U) TNet_SendUDP( 1, "UDP" ) 'To ALL If KeyDown(Key_Y) TNet_SendUDP( 1, "STRESS UDP" ) 'To ALL If KeyHit(Key_N) For N = 1 To 1000 TNet_SendUDP( 1, "UDP" ) 'To ALL Next EndIf If KeyHit(Key_N) For N = 1 To 1000 TNet_SendTCP( 1, "TCP" ) 'To ALL Next EndIf If TNet_Receive(1) LastMSG = TNetData DrawRect X,280,30,5 X:+7 If X > 320 X = -20 Flip;Cls Wend
If you get any errors please report them.