https://github.com/marekjm/java-phone-network-simulator
A phone network simulator (school project)
https://github.com/marekjm/java-phone-network-simulator
Last synced: 10 months ago
JSON representation
A phone network simulator (school project)
- Host: GitHub
- URL: https://github.com/marekjm/java-phone-network-simulator
- Owner: marekjm
- Created: 2016-06-10T22:03:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-17T20:47:02.000Z (over 9 years ago)
- Last Synced: 2025-02-02T02:46:07.758Z (11 months ago)
- Language: Java
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# Phone network simulator
The simulator is a network of microservices waiting for commands on sockets.
There are two types of nodes in the network:
- `Cell`: a microservice representing a phone tower,
- `Phone`: a microservice representing a phone,
There is no limit imposed on number of cells and phones in a network.
The network is only limited by available number of ports (that still leaves
about 64000 nodes).
----
## Cells
Cells are spawned using either one of the following commands:
- `java Cellular.Cell `: a standalone cell, usually used for spawning the first cell
in a network,
- `java Cellular.Cell `: a cell that is linked to a ``,
Both `` and `` must be valid port numbers (sockets are opened on them).
Cells are noninteractive nodes, they only route, send, and respond to messages.
----
## Phones
Phones are spawned using this command: `java Cellular.Phone ''`.
The command will create a process representing a phone with number ``, with a
socket open on port ``.
Once a phone is running, it must be registered in a cell using `register ` command
where `` is a port on which there is a `Cell` listening.
After connecting, a phone may send the following messages to the network:
- `trace `: trace a number, returns a path to the given phone number,
- `unregister`: unregisters from a cell,
- `send `: send a one word message to ``, message will still be
sent even if the number is untraceable (it will not be delievered, though),
- `receive`: receive and print first message waiting in queue, prints empty string if there
are no messages waiting,