This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MinerSuperComputer's profile picture

Making a super computer but i cant figure out how to redirect processes to other computers if ...

Started by MinerSuperComputer, 24 June 2013 - 12:24 AM
MinerSuperComputer #1
Posted 24 June 2013 - 02:24 AM
Title: Making a super computer but i cant figure out how to redirect processes to other computers if there already doing something


I'm creating a super computer called miner, im creating a system to send information from the user to a computer which will decide were to go from there, i have 21 nodes and 7 controllers. i need it a sorting system of sorts to sort the data income i want it to be i have one controller for three nodes (three users) and i want one user to have one node so ill need to block the port or disable the path to that computer once someones on it. but then later open it so the data can go back to the user in an http format. so i need to check what ports are open for the next computer that comes in, so i looked at "else if" but for it to detect multiple ports is my issue i need it to go in a line down the servers (123456789…) im using rednet.isOpen(m) but i want to choose the side to detect. this is on a ftb beta server if anyone needs to join and look at it.
Lyqyd #2
Posted 24 June 2013 - 01:12 PM
Split into new topic. Your title was too long to fit. You may wish to edit your post in the Full Editor and change it.
Bomb Bloke #3
Posted 24 June 2013 - 07:36 PM
So if I understand you correctly, you've got a number of nodes (workstations for users to send messages from) connecting to a number of controllers (routers to direct the messages to their destinations)?

If you're using the rednet API, then the port-based system the modem API uses is handled for you. A computer with an open rednet modem is listening on a port number equal to its computer ID (and also on port 65535, which is the channel used for rednet broadcasts).

If you're using the modem API, then you get manual control over your ports. However, the system used by the rednet API is already nearly ideal for preventing collisions.

Bear in mind it's always the sending machine that gets to decide what port it transmits on. If the destination computer is already busy dealing with another machine, you'll need to ensure it ignores data from an interjecting third-party.

There's two ways of dealing with the third machine. One is to have it wait a moment, then, if it hasn't received a response, try another port until it finds one the controller has free. I wouldn't recommend this, as it involves great complexity on the controller-side.

Another is to simply ensure all transmissions are short. If a system wants to send a great amount of data, have it send it as multiple chunks - or "packets" - of information, so that other systems can slip their data requests in the gaps between sends.