Skip to content

Instantly share code, notes, and snippets.

View muhammadimran-dev's full-sized avatar
🎯
Focusing

Muhammad Imran muhammadimran-dev

🎯
Focusing
View GitHub Profile
@muhammadimran-dev
muhammadimran-dev / tcpserver.txt
Last active July 19, 2020 22:24
COVID TCP Server using netcat port 4040
This program implements a Covid lookup service over TCP or Unix Data Socket.
It loads CSV Covid Dataset information using package lib (open github link at the end) and uses a simple text-based protocol to interact with the client and send the data. Clients send covid dataset search requests as a textual command in the form:
> nc localhost 4040
> {“query”: {“region”: “Sindh”}}
> {“query”: {“date”: “4/4/2020”}}
for query It’s mendatory to follow the given JSON Structure as it is given above.
When the server receives the request, it is parsed and is then used to search the list of covid Dataset. The search result is then printed JSON Format dataset to the client.
Focus:
This version of the server uses TCP sockets (or UDS) to implement a simple text-based application-level protocol. There are no streaming strategy employed for the read/write operations. Buffers are read in one shot creating opportunities for missing data during read.
Testing:
@muhammadimran-dev
muhammadimran-dev / ticTacToe.cpp
Created July 19, 2020 22:22
Tic-tac-toe is a game where two players X and O fill the hash shaped box (consist of two vertical lines crossing two horizontal lines) with their alternate turns. The player who first fills the box with 3Xs or 3Os in a horizontal, vertical, or diagonal manner will win the game. In some cases, when none of the players succeeds in filling the boxe…
#include <iostream>
using namespace std;
void ticTacToe();
void diplayGameBoard(char gameBoard[][3]);
void inputUserA(char gameBoard[][3]);
void inputUserB(char gameBoard[][3]);
bool isAWinner(char gameBoard[][3]);
bool isBWinner(char gameBoard[][3]);