Implementation of Sockets in c++
To create programs of server and client using sockets that can do the following.
- Basic Client-Server
- Client-Server message send/recieve
- Client-Server message send/recieve on different machines
- Multiple client connections
- File upload/download
- Any 5 commands specified on client to execute on server
./server <port>
./client <hostname> <port>
g++ -pthread server.cpp -o server
g++ client.cpp -o client
Server uses pthread to allow multiple client connections, hence
-pthread
is required to compile it.
Commands available once the connection is established.
pwd
cd <directory>
ls
fileup <path/filename>
The file from client machine is saved on server machine where server executable is placed.
filedown <path/filename>
The file from server machine is saved on client machine where client executable is placed.
(Calculation done on server)
neg <integer>
Returns negative of integer provided.
add <int> <int> <int> ....
Returns sum of all the integers provided.
mul <int> <int> <int> ....
Return product of all the integers provided.
More to be added soon