Jump to content

Ways of communication between two programs running on the same machine?


Masterxilo
 Share

Recommended Posts

What's wrong with local networking? That's how I would do it.

 

I think some OSs won't even let you use shared memory hacks.

 

You can also use the command line and console output, if it is a start/stop kind of operation.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Well you can transfer 3GB per sec with text files, I think network is slower (if you have 1GBit per sec card). The 3GB limit comes from the SATA2 speed, so in SATA3 it's 6GB per sec.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Linux doesn't use text files for that. It just looks that way because of the "everything is a file" philosophy of linux (which I like). Often it uses named pipes, which appear to be a file and you can use fread/fwrite like a file (although seeks won't work) but it's actually just an in-memory implementation. The whole /proc filesystem is like this, kernel parameters that just appear to be files.

 

I'd recommend using the network stack. Use UDP so you don't have to establish a connection and have the TCP overhead. If you go to localhost (127.0.0.1) then it doesn't actually use the network card at all, so you don't get the interrupt overhead of hitting the pci bus or anything.

 

Here's some of your options for windows: Interprocess Communications

 

I'd say sockets or pipes would be the best way to go.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

Is your app clearly designed for network use? If I come across a program that is requesting network access, and I don't think of it as a network app, I'll instruct my firewall to deny the communication. I won't let just any old program use the network interface. To my knowledge Sophos Client Firewall (which I use in windows environments) is really paranoid, I think it requests your attention even if a process is listening or sending on the loopback.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Mumbles have you ever played half-life? Did your firewall ask you for permission with that game because I know that does networking between itself even for singleplayer mode. I'm just curious if the firewall gets involved on the same PC networking.

 

Actually no, I'm one of the rare few people in the world that hasn't played it. But also there would be a case that if there was an option for "Multiplayer" in the menu, I would presume the program has a valid reason to use the network, and would have allowed it... Let's not forget though, I was only 13 when that game came out, and we certainly didn't have Sophos. A non-commercial firewall of the time probably would have silently allowed that communication.

 

 

But for a more recent example. I did play cod4 online, and both PnkBstrA and PnkBstrB had total blocks (I didn't like the software, and didn't consider it to have any valid reason to be using my network resources). I would only play on non-pb servers (iw3mp had full access). After about a year most of the cheaters had gone, you got to know the players quite well, because it would always be the same players

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Actually even the singleplayer half-life used local networking. That's why I asked. They made it that way so the transition between singleplayer and multiplayer was identical as far as the coding went. So that's why I was wondering.

 

I don't know if COD4 singleplayer is the same way or not though.

Link to comment
Share on other sites

Actually even the singleplayer half-life used local networking. That's why I asked. They made it that way so the transition between singleplayer and multiplayer was identical as far as the coding went. So that's why I was wondering.

 

I don't know if COD4 singleplayer is the same way or not though.

 

If it's the same executable, I would have allowed network access by the way I grant access today. If it's a different exe though, I would just have complained that they were awful programmers, and at that age, would have claimed that I could do better myself - I'm told all moody teenagers are like that. Shocking to believe that I once was one...

 

...And on the cod4 front, the single player exe never asked for network access, and worked fine from start to finish.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

If it's the same executable, I would have allowed network access by the way I grant access today.

 

My curiosity was if it would have even said anything and if you would have even known. I don't remember it barking at me at anytime, but I don't think I'm using the security that you are. The only way us to test is for you to go buy HL and play it I guess :blink:

Link to comment
Share on other sites

My curiosity was if it would have even said anything and if you would have even known. I don't remember it barking at me at anytime, but I don't think I'm using the security that you are. The only way us to test is for you to go buy HL and play it I guess :)

 

Sophos will complain, I can tell you that for nothing. I won't suspend the thread like some others (*cough* McAfee) but it will disallow the communication until you've given it a definite response. But back in those days, I don't think the Sophos Client Firewall existed, and others I reckon wouldn't have cared about that. I remember McAfee I used to use would automatically grant anything it thought was trustworthy (like explorer), and I don't ever remember it complaining that something was listening on the loopback (or sending there). firewalls designed for home use (which are more likely than business use firewalls to intercept games related traffic), don't want to be too complicated to use or no one will buy them.

 

Sophos don't make any home products. What I bought was Sophos Computer Security, Small Business Edition., and you get what you play for. The 'more' that I've paid for (and thus got) would probably confuse the life out of your average home user. But that said, the method of using the loopback interface (which was the point of this thread before I took it on a strange trip somewhere else), would probably work absolutely fine in most cases. Not many people are as strange as I am. I just raised the issue because it's something to think about. I don't think any of the options listed are perfect so it comes down to which would work for the largest number of people. Loopback is probably the simplest to implement and shouldn't encounter too many users who deny access.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...