Sending values from .exe GLbasic to another

Previous topic - Next topic

mentalthink

Well the question it's very simple, How I can send values (in example the X/Y axis of the Mouse) from an .exe to another made  both whit GLBasic.

I 'm  thinking using a .TXT file common for both... but I want write directly to an Array in the main Program, how I can access to it, like a bridge between both

Thanks for your help. :blink:
Iván J.

r0ber7

You could use the networking commands through localhost. Still not a direct access to the array, but I suspect most operating systems won't allow one program to access the memory allocated by another program. At least not easily. ;)

hardyx

You can use File Mapping functions in Windows to access memory between processes, but it's not easy.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms686958%28v=vs.85%29.aspx

mentalthink

Thanks guys!!! , I think this can be easy but I look doesn't it...

I think I use a simple .txt looking for modifies date... and then when I finish to work whit the editor copy the info into the source Code...

Thanks for clarify me this point...

Regards,

kanonet

I see two options:
- networking commands (thats the way i do it in my DDcreator). Networking is really easy, just try it.
- GETENF/PUTENV if youre allowed to access an environment variable from different apps (think so, but not sure), then you can send few data, should be ok if you just send mouse coordinates, if you send more data, go with networking.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

MrTAToad

I think if I remember correctly you can use Global Atoms (if you are developing for Windows) - but that only takes a string

mentalthink

HI Kanonet , yes I think about using a server and client application, and the other method - GETENF/PUTENV I never use, thanks I have to take a look...

MrT thanks for the info, but how you know I don´t have too much skills about C++ or another language...

Thanks to both, very usefully all this information .

Wampus

Hey mentalthink/everyone, if you go the server and client route here is a little important tip:-

Unless your app knows the IP addresses of the devices/computers it is trying to exchange data with you need to 'discover' them on the network by broadcasting with UDP. As you may know this is covered in the Networking for cowards part 2 tutorial on this forum. There is also an example in the GLBasic SAMPLES - NETWORK folder. An app called BROADCAST demonstrates how to do it. However, it uses the broadcast address 255.255.255.255. That works some of the time, for instance it does on my home cabled ethernet, but when communicating over wifi and/or between different OSes like Android and Windows, you should also/alternatively use the LAN address 192.168.1.255, or 10.10.1.255, etc. depending on the type of LAN address you get back with NETGETIP$(). Its still not guaranteed to work, so in some cases you have to enter in IP addresses manually. Still, I find 192.168.1.255 works from Android to PC, Android to Android on my home wireless network when 255.255.255.255 does not.

Hopefully that wasn't too confusing.

mentalthink

Hi Wampus, sometimes I do a server-client connections and I never have troubles... now I'm not sure "Timofonica" changes my router, and this it's an absolute toy... don´t have any option for configure... and seems fail a lot...

Thanks for the advice... I will be carefully whit your "info"

r0ber7

Are both programs running on the same computer? Because if they are, you can just use localhost (127.0.0.1) and there's no need for any UDP broadcasting or any of the above. I'm currently using it to test out my multiplayer setup.

https://en.wikipedia.org/wiki/Localhost

Wampus

r0ber7 how is that going with the multiplayer? I'm working on my multiplayer setup too atm. First I'm doing a little prototype program that will let devices draw on the screen and send the data to a server so other devices can see what is going on. Once that is working as well as I can get it I'm going to include the code in my main game.

That thing I mentioned about broadcasting came up because I really want LAN play. Ideally different devices should be able to discover the host game(s) while avoiding having to manually enter a network IP address/port. I've got that mostly working.

If you decide to do LAN play as well as internet play I found a really useful article about how to determine the broadcast address from a machine's IP address: Identifying the network and broadcast address of a subnet.

Have to say, the network stuff in GLBasic is relatively painless so far.