Is it possible to have multiple servers on a single computer?

Started by KingJellyfishII, Dec 26, 2019, 08:39 PM

Previous topic - Next topic

KingJellyfishII

I was thinking, since I am making the internet it needs to be possible to have several servers on a single computer, i.e. a web server and a file server. But I don't know if/how this would work, since os.pullEvent("modem_message") doesn't take a parameter of which modem I want to recieve a message from.

So what is the correct behaviour when two os.pullEvent("modem_message")'s are running in parallel, in different tabs? Does this make the computers effectively single-thread only when it comes to networking? Is there a workaround?

If you can't see I'm a bit confused on this entire matter, if there's a place I can go to learn in-depth about how networking works in CC then I'd really like to see it (ofc there's the source, but I'm a little too lazy to read through that).

thanks in advance for any help on the matter.

Lupus590

sounds like you want to use modem channels like real servers use ports

you might also want to look into rednet protocols

KingJellyfishII

Quote from: Lupus590 on Dec 26, 2019, 09:45 PMsounds like you want to use modem channels like real servers use ports

you might also want to look into rednet protocols

Yeah I thought they did work like ports... but apparently not. And yeah I've looked into the rednet protocol and from what I can gather it uses the channel as the IP address, but I need them to be seperate. And isn't rednet just a wrapper around the modem API? Because if rednet can do it then I want to implement that into my own API (that more closely mimicks the reall internet protocol by adding IP addresses which are sent along with the message).

Lupus590

if you use channels like ip addresses then protocols will be your ports

you might want to look CCNet

honestly, computercraft's network 'stack' doesn't work like real life, it's very simplified and adding an IP and port system would just add complexity for no gain. If you still want the complexity then you might be better suited to open computers than computercraft

KingJellyfishII

Quote from: Lupus590 on Dec 27, 2019, 03:29 PMif you use channels like ip addresses then protocols will be your ports

you might want to look CCNet

honestly, computercraft's network 'stack' doesn't work like real life, it's very simplified and adding an IP and port system would just add complexity for no gain. If you still want the complexity then you might be better suited to open computers than computercraft

yeah I do want complexity, I'm trying to emulate as close to real life as possible. However in the past I have done something similar with OpenComputers (which is really cool btw BUT makes half of my work obsolete) but I've come across a critical bug, where if you unload a computer while it's running then the HDD can get wiped or "switched" with another computer... I might revisit opencomputers though.

Lupus590

Quote from: KingJellyfishII on Dec 27, 2019, 10:25 PMI've come across a critical bug, where if you unload a computer while it's running then the HDD can get wiped or "switched" with another computer

never heard of that happening, if you can find a way to consistently replicate that then do make a bug report and let @SquidDev know


on topic, if you haven't though of it yet you might want to treat the computer id's like mac addresses and build on top of that

KingJellyfishII

Quote from: Lupus590 on Dec 27, 2019, 11:38 PMnever heard of that happening, if you can find a way to consistently replicate that then do make a bug report and let @SquidDev know

I will, there's a chance it's already been patched but I'll have a check.

Quote from: Lupus590 on Dec 27, 2019, 11:38 PMon topic, if you haven't though of it yet you might want to treat the computer id's like mac addresses and build on top of that

Hadn't thought of that but it sounds like a good idea. I'll do some brainstorming...