variables and executable programs

Blitz3D Forums/Blitz3D Programming/variables and executable programs

syntax(Posted 2008) [#1]
I have two executable programs running on the same machine and I want to pass a single integer variable from one to the other. can it be done?


GfK(Posted 2008) [#2]
Could run one as a client and one as a server, and send it via TCP/IP or UDP.


syntax(Posted 2008) [#3]
never mind, i just realized I can tell one program to edit a txt file and place a number in it, while the other one updates and opens that txt file receiving the number. if anyone knows a better way to do this, i would be very much appreciative.


Mortiis(Posted 2008) [#4]
I was about to advise that. But If you are going to use one of the programs in another machine that will be a problem. You have to use them both on the same computer. It's how the game launcher/setting screens are done.


GfK(Posted 2008) [#5]
Vista isn't going to like it if you start dumping temporary files on the hard drive.


Ross C(Posted 2008) [#6]
Use the commandline parameter? Or is that just when you start up the app you can use that? Never mind, i think it is :o)

Vista sucks!

/me runs


Bobysait(Posted 2008) [#7]
CommandLine just keep the command entered on starting the app.
For Realtime transfert, it's better using UDP ( on local machine, there is no paquet lost, so UDP is much faster than TCP or whatever )

An over way is to push a variable in RAM, and access it using Memory lib, but maybe permissions will deny the peek/poke into memory from application that does not own the block of memory to peek/poke. Maybe using a sharing memory library, it could be done, and probably very fast...


dynaman(Posted 2008) [#8]
The file passing bit works fine, just make sure it is done to a non-proteced bit of the file system.


Bobysait(Posted 2008) [#9]
For sure it works, but you don't care about the life of your hard disk ? :)
Dealing with memory or sharing-protocol is cheaper


Gabriel(Posted 2008) [#10]
For Realtime transfert, it's better using UDP ( on local machine, there is no paquet lost, so UDP is much faster than TCP or whatever )


This is wrong. Even on localhost, packets can go missing. You cannot ever assume that UDP is lossless or ordered.


Bobysait(Posted 2008) [#11]
If you lose paquet on a local machine (eg: 127.0.0.1), maybe you've got troubles, whatever, according the lost, it's easy enough to prevent ( using an ID for each messages, so you 'll know if lost occured )


Gabriel(Posted 2008) [#12]
If you lose paquet on a local machine (eg: 127.0.0.1), maybe you've got troubles, whatever

No, you don't have troubles if you're losing packets with UDP on localhost. You just don't understand how UDP works.


Bobysait(Posted 2008) [#13]
"MAYBE" means it isn't necessary due to a trouble, I just pointed the fact it's pretty easy to prevent loosing, that we can't really loose a message from the sender+> we only need to ask him to "resend" the paquet, so the trouble I pointed is in the way you code your UDP streaming

Of course there are "lots" of paquets lost in UDP transfert, but to send only an integer value, it should be efficient enough


chi(Posted 2008) [#14]
why not use shared memory? its fast and there´s no packet loss ;)