This gem provides a CLI (Command Line Interface) that allows the following apps to work together:
-
The client app
-
Reads 1024 bytes from /dev/urandom
-
Cleans out all non UTF-8 compliant chars
-
Replaces all spaces with asterix
-
Sends this data to a server via TCPSocket
-
-
The server app
-
Listens for any connections
-
Accepts the data from the client app
-
Prints it into a log file
-
Installation
From RubyGems
The easiest way to install the application is to install as a gem from RubyGems. Run the command below
$ gem install crossover
From source code
-
If you have access to the Internet, obtain the source code from Github repository.
$ git clone https://github.com/rhc/crossover.git
-
If you have access to the ChristianKyony_SE_Ruby_Network.zip archive, go to the Code folder.
$ unzip ChristianKyony_SE_Ruby_Network $ cd Code
-
Access the source code folder directory.
$ cd crossover
-
Install the dependencies
$ bin/setup
-
Install the gem in your local machine
$ bundle exec rake install
-
Run the test suite
$ rake test
Usage
Basic Usage
You need only two commands. Start by launching the server app.
$ crossover server
The server will be listening on TCP port 50000 and will log all data received from TCP clients in the ~/crossover.log file.
You should see something similar to the following:
[Wed Jan 25 22:50:02 2017] Crossover::Server 127.0.0.1:50000 start
To send data to the server on the default port, run the command below
$ crossover client
The client will automatically send data to the running server. You should see something similar to the following:
Sending 504 bytes to port 50000 on 127.0.0.1.
Vw9y
Bye!
Advanced Usage
You can get help on available commands.
$ crossover help
Commands:
crossover --version, -v # Print the version
crossover client # Send data to a remote HOST listening on PORT
crossover help [COMMAND] # Describe available commands or one specific command
crossover server # Launch a server listening on PORT
You can get help on specific options when launching the server app with crossover server
$ crossover help server
Usage:
crossover server
Options:
-h, [--host=HOST] # Default: 127.0.0.1
-p, [--port=N] # Default: 50000
-l, [--logfile=LOGFILE] # Default: ~/crossover.log
-c, [--max-connections=N] # Default: 1000
You can get help on specific options when launching the client app with crossover client
.
$ crossover client
Usage:
crossover client
Options:
-h, [--host=HOST] # Default: 127.0.0.1
-p, [--port=N] # Default: 50000
-d, [--data=DATA]
License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Assumptions
-
This gem has been developed for POSIX system (LINUX, MAC OS)