Info on Multiplayer and Gnet?

BlitzMax Forums/BlitzMax Programming/Info on Multiplayer and Gnet?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This is how I would have "packed" the package to bytes.
	
Function Create:Packet(msg:String)
	Local p:Packet = New Packet
	p.size = Len(msg)
	p.bytes:Byte Ptr = msg.ToCString() 'Convert to bytes
	Return p
End Function 

Method UnPack:String()
	Return String.FromBytes( bytes, size)
End Method


Also when you do the Asci/byte math:
For Local i = 0 To p.size-1
p.bytes[i] = Asc( Mid$( msg,i+1,1 ) )
Next
This is the new BlitzMax Way. Nicer and easier to read once you get used to it.
For Local i = 0 To p.size-1
p.bytes[i] = msg[i]
Next

Also I also think you can use Until instead:
For Local i = 0 until p.size
p.bytes[i] = msg[i]
Next