1. Message-passing via local ports

Last year I posted a question about the potential in OE/Phix for implementing a message-passing framework and 'actor' objects (see https://openeuphoria.org/forum/134721.wc?last_id=134721#134721). Since I got a mixed response, I have been rethinking the question and I came to the conclusion that it's not really necessary to implement a message-passing framework as such (as outlined in the original post), i.e. running as one program. A microservices-type architecture may also be used instead, with each object running as an autonomous program, in its own thread. This approach would eliminate the need for an overarching unified framework (i.e. a single program) to manage and supervise the actor objects. Objects would pass messages to one other via local ports (localhost:portnumber).

I would like to get some feedback from you guys regarding the feasibility of this approach. I would be using Phix.

In particular, do you expect any difficulties with having different programs exchange messages via local ports?

Thanks a lot,

-GreenEuphorian

new topic     » topic index » view message » categorize

2. Re: Message-passing via local ports

It's possible, several people have done it, between programs, between languages and operating systems, between computers on a lan, and across the internet. There's rudimentary win and nix "chat" programs that exchange "data" in the archives from many years ago. I submitted code to use socks connecting Eu to Mirc decades ago, both localhost and across the lan, and was roundly denounced.

If you are favorable to those "in charge", you will beome the deity of choice, else you will be ridiculed and forgotten. I don't even volunteer code any more (see irc.e , and the http.e-tasks-news.ex fiasco).

My "claim to fame" would be i hooked the type system to make sharing happen with only the one keyword. I used IPC, thinking it was faster, but i did no speed tests. I also was/am leery of the OS blocking on winsock calls in compiled OE, although this is not a problem running interpreted with tasks.e.

Good lucks to you.

Kat

new topic     » goto parent     » topic index » view message » categorize

3. Re: Message-passing via local ports

This stuff is all a bit beyond me, but since the original post I have added a rudimentary sockets lib to phix, not sure if it will be any help, or riddled with bugs...

Note that it is currently windows-only, but was written such that getting it to work on Linux should only require relatively minor tweaks, from someone who knows what they're doing.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Message-passing via local ports

GreenEuphorian said...

In particular, do you expect any difficulties with having different programs exchange messages via local ports?

You can simulate events with tasks.e doing polling (The actual shared data var will be filled up transparently to the main program) : create some shared variable as a flag that says "data is here!", or maybe one that says "i just got x bytes of data!", let a task poll that variable. Because the variable is (or can be) shared in both directions, resetting it in the main program can change the state in the aux program. Handshaking. Else, cache number, or hdd filename. In sending and recieving large files to/from Mirc to/from anywhere else, i used winsock's buffers, the favorable side effect being effectively a task_yield, allowing other code to run.

Kat

new topic     » goto parent     » topic index » view message » categorize

5. Re: Message-passing via local ports

Thanks a lot, Kat & Pete. I will look into it.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Message-passing via local ports

I forgot and had to go way afk, just got back... the message format : i have been passing only flat data, that is: one-level sequences, integers, atom booleans. Passing a 0 (zero) might mess you up, if it's interpreted as a null terminator. There's various ways to deal with messages and error detection and correction, i think it's a whole science by itself : "How To Trick The OS Into Letting You Program It". There's libraries in the archives for some issues, such as flattening nested sequences and unflattening them.

Kat

new topic     » goto parent     » topic index » view message » categorize

7. Re: Message-passing via local ports

katsmeow said...

It's possible, several people have done it, between programs, between languages and operating systems, between computers on a lan, and across the internet.

And in addition to OP, I'm another one who has done it.

katsmeow said...

There's rudimentary win and nix "chat" programs that exchange "data" in the archives from many years ago.

Good to know.

katsmeow said...

I submitted code to use socks connecting Eu to Mirc decades ago, both localhost and across the lan, and was roundly denounced.

That was before the gensis of the OE dev team, I believe. Today, you'd get a much more welcome reception, I guarantee.

katsmeow said...

If you are favorable to those "in charge", you will beome the deity of choice, else you will be ridiculed and forgotten. I don't even volunteer code any more (see irc.e , and the http.e-tasks-news.ex fiasco).

Speaking formally on behalf of both the dev team and the admin team, and also the moderator team, I can promise that no one will be ridiculed.

Speaking formally on behalf of the dev team, I can promise that any code that gets volunteered would be accepted today (albeit that the devs might make some modifications to make it look more similar to other parts of the stdlib and so on).

katsmeow said...

My "claim to fame" would be i hooked the type system to make sharing happen with only the one keyword. I used IPC, thinking it was faster, but i did no speed tests. I also was/am leery of the OS blocking on winsock calls in compiled OE, although this is not a problem running interpreted with tasks.e.

I would think you have much more than just this.

katsmeow said...

Good lucks to you.

Kat

Ditto.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu