TNet recompiled for 1.12

BlitzMax Forums/BlitzMax Programming/TNet recompiled for 1.12

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.
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.

Very happy that the flushmem problem has gone away!! I will check that with my game !!

Thank U for taking a look, but it still doesn't work for me :(

Linking:server.debug.exe
C:/Program Files/BlitzMax/mod/pub.mod/tnet_basic.mod/tnet_basic.debug.win32.a(tnet_basic.bmx.debug.win32.o.b)(code+0x70fa): undefined reference to `brl_system_KeyDown'
C:/Program Files/BlitzMax/mod/pub.mod/tnet_basic.mod/tnet_basic.debug.win32.a(tnet_basic.bmx.debug.win32.o.b)(code+0x7336): undefined reference to `brl_system_KeyDown'
Build Error: Failed to link E:/Plane/server.debug.exe

ok try making a simpler demo than that above

Like this:
TNet_HostUDP(12345)

Build and run.

Seems like there is a problem with 'brl_system_KeyDown'?

NICE!!

Got it workin now thanks alot, and it seems to be alot less laggier..

thanks so much im not sure what happen before I sorta wish I knew lol.