Giter Site home page Giter Site logo

net-cat's Introduction

net-cat

Objectives

This project consists on recreating the NetCat in a Server-Client Architecture that can run in a server mode on a specified port listening for incoming connections, and it can be used in client mode, trying to connect to a specified port and transmitting information to the server.

  • NetCat, nc system command, is a command-line utility that reads and writes data across network connections using TCP or UDP. It is used for anything involving TCP, UDP, or UNIX-domain sockets, it is able to open TCP connections, send UDP packages, listen on arbitrary TCP and UDP ports and many more.

  • To see more information about NetCat inspect the manual man nc.

Your project must work in a similar way that the original NetCat works, in other words, you must create a group chat. The project must have the following features :

  • TCP connection between server and multiple clients (relation of 1 to many).
  • A name requirement to the client.
  • Control connections quantity.
  • Clients must be able to send messages to the chat.
  • Do not broadcast EMPTY messages from a client.
  • Messages sent, must be identified by the time that was sent and the user name of who sent the message, example : [2020-01-20 15:48:41][client.name]:[client.message]
  • If a Client joins the chat, all the previous messages sent to the chat must be uploaded to the new Client.
  • If a Client connects to the server, the rest of the Clients must be informed by the server that the Client joined the group.
  • If a Client exits the chat, the rest of the Clients must be informed by the server that the Client left.
  • All Clients must receive the messages sent by other Clients.
  • If a Client leaves the chat, the rest of the Clients must not disconnect.
  • If there is no port specified, then set as default the port 8989. Otherwise, program must respond with usage message: [USAGE]: ./TCPChat $port

Instructions

  • Your project must be written in Go

  • Start TCP server, listen and accept connections

  • Your project must have Go-routines

  • Your project must have channels or Mutexes

  • Maximum 10 connections

  • The code must respect the good practices

  • It is recommended to have test files for unit testing both the server connection and the client.

  • You have to be able to handle the errors from server side and client side

Usage

$ go run .
Listening on the port :8989
$ go run . 2525
Listening on the port :2525
$ go run . 2525 localhost
[USAGE]: ./TCPChat $port
$
  • You should answer the client with a linux logo and ask for their name, when connection is received
$ nc $IP $port
Welcome to TCP-Chat!
         _nnnn_
        dGGGGMMb
       @p~qp~~qMb
       M|@||@) M|
       @,----.JM|
      JS^\__/  qKL
     dZP        qKRb
    dZP          qKKb
   fZP            SMMb
   HZM            MMMM
   FqM            MMMM
 __| ".        |\dS"qML
 |    `.       | `' \Zq
_)      \.___.,|     .'
\____   )MMMMMP|   .'
     `-'       `--'
[ENTER YOUR NAME]:
  • Accept connection with non-empty name

The client :

$ nc $IP $port

Server:

$ go run . 2525
Listening on the port :2525

Bonus

This project will help you learn about :

net-cat's People

Contributors

diasoryntayev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.