Repository for COMP 429 Programming Assignment# 1 - A simple chat application, by Sabra Bilodeau.

Overview

Chatty

COMP 429 Programming Assignment 1
A Chat Application for Remote Message Exchange
by Sabra Bilodeau

Getting Started with Chatty

Building the Program

  1. Download Go, if you don't already have it installed on your local machine.
  2. Download the source code via one of these two methods
    a. Clone the repository by running git clone https://github.com/Cryliss/comp-429.git in the terminal
    b. Download the source code directly from GitHub, and place it in your Go source code directory - e.g. /Users/sabra/go/src
  3. From terminal, navigate to the chat application directory. e.g. cd ~/go/src/chat
  4. Run make build to build the applications binary file

make build builds the program with the --race flag in order to help catch any data races that may occur within our application due to the goroutines. (ideally none will, but just in case .. )
An example (that has since been corrected!) is below:

==================
WARNING: DATA RACE
Write at 0x00c0001247e0 by goroutine 7:
  runtime.mapassign_fast32()
      /usr/local/go/src/runtime/map_fast32.go:92 +0x0
  chat/server.(*Server).Run()
      /Users/sabra/go/src/chat/server/core.go:101 +0x3be

Previous read at 0x00c0001247e0 by main goroutine:
  runtime.mapiternext()
      /usr/local/go/src/runtime/map.go:851 +0x0
  chat/server.(*Server).List()
      /Users/sabra/go/src/chat/server/core.go:211 +0x167
  chat/app.(*Application).ParseInput()
      /Users/sabra/go/src/chat/app/core.go:140 +0x484
  main.main()
      /Users/sabra/go/src/chat/bin/chat/main.go:65 +0x42a

Goroutine 7 (running) created at:
  main.main()
      /Users/sabra/go/src/chat/bin/chat/main.go:46 +0x353
==================

Running the Program

Starting the program can be done by entering one of two commands into terminal:

  1. ./chat -port
  2. make run will automatically run on port 8888

Application Starting Output

CHATTY: A Chat Application for Remote Message Exchange
------------------------------------------------------
Available commands:
    1. help
    2. myip
    3. myport
    4. connect 
    
    
     
    5. list
    6. terminate 
     
      
    7. send 
       
       
         8. exit You may either type the command name, i.e. 'connect 
         
         
          ', or the command number, i.e. '4 
           
           
            ' Type 'help' for an explanation of each command, or type 'help 
            ' to get the explanation for a specific command Please enter a command: 
           
          
         
        
       
      
     
    
   

Programming Assignment Details

Environment Requirements

(1) Use TCP Sockets in your peer connection implementation
(2) Use the select() API or multi-threads for handling multiple socket connections
(3) Integrate both client-side and server-side code into one program and run on each peer

Functional Requirements

  • help: Display information about the available user interface options or command manual.
  • myip: Display the IP address of this process.
  • myport: Display the port on which this process is listening for incoming connections.
  • connect {destination} {port no}:
    • This command establishes a new TCP connection to the specified {destination} at the specified {port no}. The {destination} is the IP address of the computer.
    • Any attempt to connect to an invalid IP should be rejected and suitable error message should be displayed.
    • Success or failure in connections between two peers should be indicated by both the peers using suitable messages.
    • Self-connections and duplicate connections should be flagged with suitable error messages.
  • list:
    • Display a numbered list of all the connections this process is part of.
    • This numbered list will include connections initiated by this process and connections initiated by other processes.
    • The output should display the IP address and the listening port of all the peers the process is connected to.
  • terminate {connection id}:
    • This command will terminate the connection listed under the specified number when 'list' is used to display all connections.
    • An error message is displayed if a valid connection does not exist.
    • If a remote machine terminates one of your connections, you should also display a message.
  • send {connection id} {message}:
    • This will send the message to the host on the connection that is designated by the {connection id} when command “list” is used.
    • The message to be sent can be up-to 100 characters long, including blank spaces.
    • On successfully executing the command, the sender should display “Message sent to {connection id}” on the screen.
    • On receiving any message from the peer, the receiver should display the received message along with the sender information.
  • exit:
    • Close all connections and terminate this process.
    • The other peers should also update their connection list by removing the peer that exits.
You might also like...
The resource repository of the book
The resource repository of the book "gRPC - Up and Running".

The resource repository of the book "gRPC - Up and Running".

Go programming language secure coding practices guide

You can download this book in the following formats: PDF, Mobi and ePub. Introduction Go Language - Web Application Secure Coding Practices is a guide

The Little Go Book is a free introduction to Google's Go programming language
The Little Go Book is a free introduction to Google's Go programming language

The Little Go Book is a free introduction to Google's Go programming language. It's aimed at developers who might not be quite comfortable with the idea of pointers and static typing. It's longer than the other Little books, but hopefully still captures that little feeling.

Some examples for the programming language Go.

Golang_Examples Bubblesort: simple implementation of bubble sort algorithm in Go Level: Beginner GenericStack: a stack (LIFO collection) that can hold

functional programming in go

function programming experimental lib why another fp lib I like fp style and I haven’t found a lib with these features: streamingly, I can handle infi

Crash Course about the programming language Go / Golang.
Crash Course about the programming language Go / Golang.

Crash Course about the programming language Go / Golang. In this course I have covered some important concepts and topics in programming.

A complete guide to undersatnd golang programming language, web requests, JSON and creating web APIs with mongodb

Golang series A complete guide to undersatnd golang programming language, web requests, JSON and creating web APIs with mongodb LearnCodeonline.in 01

go programming language tutorial

go programming language tutorial Hello World Hello World fmt package Variables Short Declaration The Var Keyword Exploring Type Own Type Conversion Ty

Programming Paradigm With Golang
Programming Paradigm With Golang

Programming-Paradigm After running python3 1_22.py you'll get a prompt: which, after entering start and the end of the interval, should create next wi

Releases(1.0.1)
Owner
Sabra Bilodeau
Student at Cal State University - Northridge, graduating Fall '21.
Sabra Bilodeau
A repository for showcasing my knowledge of the Go! (2003) programming language, and continuing to learn the language.

Learning Go! (programming language) Not to be confused with Google Golang (2009) I don't know too much about the Go! programming language, but I know

Sean P. Myrick V19.1.7.2 1 Aug 26, 2022
Example repository for embedding Litestream in a Go application.

Litestream as Library This repository is an example of embedding Litestream as a library in a Go application. The Litestream API is not stable so you

Ben Johnson 38 Jul 2, 2022
An open source programming language that makes it easy to build simple

The Go Programming Language Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Gopher ima

null 0 Oct 15, 2021
Repository for learning GO lang

LearnGOLang Repository for learning GO lang. What is Go? Go is a fast, statically typed compiled language Compiled to machine level code, does not nee

Allan 0 Oct 15, 2021
This is the repository for the LinkedIn Learning course Learning Go.

Learning Go This is the repository for the LinkedIn Learning course Learning Go. The full course is available from LinkedIn Learning. What is Go? Go i

Zhenguan Tang 0 Nov 2, 2021
This repository contains Sougata Khan's solutions to the Exercism Golang Track

Exercism Golang Track This repository contains Sougata Khan's solutions to the Exercism Golang Track Exercises Exercism Problem Solution Description H

Sougata Khan 0 Dec 29, 2021
🐨 Go lang Study Repository.

go ?? Go lang Study Repository. 01 - Hello World Hello world in GO! What have learned? Create a module using the go init command. Declare a package. I

klaby 1 Feb 15, 2022
Gotk4-subclassing - Experimental repository for gotk4 subclassing

gotk4 A GTK4 bindings generator for Go. Package documentation | Package examples

null 1 Jan 8, 2022
The repository intent is store some Go Lang codes.

⚠️ Go programming course ⚠️ This repository was created to share the Learn How To Code: Google's Go (golang) Programming Language code created by Todd

Vagner Wentz 2 Jan 16, 2022
A repository with my resolutions of the GO exercises from github.com/gophercises

GOPHERCISES A repository with my resolutions of the GO exercises from github.com/gophercises Gophercises is a FREE course that will help you become mo

Lucas Oliveira 0 Feb 1, 2022