Send files

BlitzPlus Forums/BlitzPlus Programming/Send files

Starwar(Posted 2007) [#1]
Does anybody know how to send files in an Blitz+ Program?


Gabriel(Posted 2007) [#2]
Wanna be a bit more specific? Send them to where? From where?


Starwar(Posted 2007) [#3]
From PC to Pc. Peer-to-Peer. Like in ICQ


SebHoll(Posted 2007) [#4]
Deep breath...

You need to establish a TCP connection between a client and a server app. On the server app, the file should be loaded into a bank, and then using the WriteBytes command, write the bank's content to the network stream to be received by the client with ReadBytes into a bank, which you can then save as a file.


Starwar(Posted 2007) [#5]
Thank you. But this will be my first program using Bank/TCP. Do you have an example? That would be really nice ;-)


Andres(Posted 2007) [#6]
From one PC to another? On a LAN:
file% = WriteFile("\\Machine\SharedFolder\file.jpg")



SebHoll(Posted 2007) [#7]
I haven't really used BlitzPlus for a long time as I now use MaxGUI, but I found this code in the archives and have adapted it for sending files. I haven't tested it but it should work:

Server:



Client (run after you've started the server):



Sorry if it doesn't work (I don't have BlitzPlus installed) but it should give you a *very* primitive idea of how to transfer a file. To be used, in practice, you need to send network messages etc.



Seb


Sonari Eclipsi Onimari(Posted 2007) [#8]
If its a binary file, like a BMP, readstring$ and writestring$ can send a pic PDQ.