VK internship assignment
Simple server for receiving files from multiple clients and client for sending files
- pure C11
- multithreading with
pthreads
for receiving multiple files in parallel - the fastest way of IO multiplexing - using
epoll
- memory-mapped file IO to omit allocation of buffers
- comprehensible error messages
Server:
Server [port] [saving_dir]
Default port and directory for files are 1026
and /tmp
(can be reconfigured)
Client:
Client <address:port> <path_to_file> [name_on_server]
Default name_on_server is same as the original filename
The following constants can be set in server_conf.h
before compilation:
BACKLOG
- queue size for accepting connections, other ones likely to be rejectedMAX_EVENTS
- maximum number of file descriptors returned byepoll_wait
TIMEOUT
-epoll_wait
timeoutNUM_THREADS
- number of additional threads besides main- 'DEFAULT_PORT'
- 'DEFAULT_PATH'
Via cmake
Tested with modern gcc
, language standard is C11