TSocket/TSocketStream in banks

BlitzMax Forums/BlitzMax Beginners Area/TSocket/TSocketStream in banks

Andres(Posted 2007) [#1]
How can i keep such variables in a bank?

I'm trying to create a remote file engine in BMax, but i don't know exactly how to store them in a bank and i need to keep TSocket and TSocketStream in it.

PokeInt(bank, 0, socket:TSocket)


?


Blueapples(Posted 2007) [#2]
Why do you need to store them in a bank? Better to use a Type for this probably. If you're sending bank data over the wire, object handles (about the only thing you could store in a bank other than just the port number) will be useless on the other end.


Gabriel(Posted 2007) [#3]
HandleFromObject and ObjectFromHandle?


Blueapples(Posted 2007) [#4]
But as I said, why? If it's to send on the network, that's useless. If it's just to store in memory for reference later, then a Type works better.


Andres(Posted 2007) [#5]
Thanks for the guides. I started to use types and this is the current code i've made:


Function OpenRemoteFile:TRemoteFile(url:String, port:Int = 80, postdata:String = "") can be used to open a remote/online file. After that you'll need to check for errors: RemoteFileError:String(file:TRemoteFile) and then you can start to read with ReadRemoteLine:String(file:TRemoteFile)