Skip to content

Commit 27bc37c

Browse files
author
Anton Yarkov
committed
Regrouped example to make common header/lib files.
1 parent ab2bc25 commit 27bc37c

14 files changed

+24
-0
lines changed

networking/02 Astro-tcp-server/0_simple_blocker_server.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
// Create a TCP-server which returns astrological forecasts as a response to client command HOROSCOPE.
1515
// It should remember forecast on a STARS SAY command from client. Server should handle possible errors.
1616

17+
// Compile:
18+
// gcc -std=c99 0_simple_blocker_server.c -o simple_blocker_server
19+
1720
// Function read number of bytes and return it. It is necessary to use such a function for read,
1821
// because system call recv may return not full response and it will be necessary to read in loop.
1922
ssize_t receive_all(int fd, char *buf, size_t len)

networking/02 Astro-tcp-server/1_automata_based_server.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
// It should remember forecast on a STARS SAY command from client. Server should handle possible errors.
3333
// This implementation should be created as automata - it is a middle step from simple blocked server to fully asynchronous server.
3434

35+
// Compile:
36+
// gcc -std=c99 1_automata_based_server.c -o automata_based_server
37+
3538
char zodiaks[12][12] = { "Aries ", "Taurus ", "Gemini ", "Cancer ",
3639
"Leo ", "Virgo ", "Libra ", "Scorpio ", "Sagittarius",
3740
"Capricorn ", "Aquarius ", "Pisces " };

networking/02 Astro-tcp-server/2_select_multiplexed_server.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
// It should remember forecast on a STARS SAY command from client. Server should handle possible errors.
2525
// This implementation should be full asynchronous based on "select" system call available in Linux.
2626

27+
// Compile:
28+
// gcc -std=c99 2_select_multiplexed_server.c -o select_multiplexed_server
29+
2730
char zodiaks[12][12] = { "Aries ", "Taurus ", "Gemini ", "Cancer ",
2831
"Leo ", "Virgo ", "Libra ", "Scorpio ", "Sagittarius",
2932
"Capricorn ", "Aquarius ", "Pisces " };

networking/02 Astro-tcp-server/client.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
// HOROSCOPE - get astrological forecasts from server.
1818
// STARS SAY - send forecast to server.
1919

20+
// Compile:
21+
// gcc -std=c99 client.c -o client
22+
2023
// Function read number of bytes and return it. It is necessary to use such a function for read,
2124
// because system call recv may return not full response and it will be necessary to read in loop.
2225
ssize_t receive_all(int fd, char *buf, size_t len)

networking/03 Multiplexed echo-server/0_select_server.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
#define PORTNUM 1500 // Port > 1024 because program will not work not as root.
1313

14+
// Compile:
15+
// g++ -std=c++11 0_select_server.cpp -o select_server
16+
1417
int set_nonblock_mode(int fd)
1518
{
1619
int flags;

networking/03 Multiplexed echo-server/1_poll_server.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
#define PORTNUM 1500 // Port > 1024 because program will not work not as root.
1616

17+
// Compile:
18+
// g++ -std=c++11 1_poll_server.cpp -o poll_server
19+
1720
int set_nonblock_mode(int fd)
1821
{
1922
int flags;

networking/03 Multiplexed echo-server/2_epoll_server.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
#define PORTNUM 1500 // Port > 1024 because program will not work not as root.
1717

18+
// Compile:
19+
// g++ -std=c++11 2_epoll_server.cpp -o epoll_server
20+
1821
int set_nonblock_mode(int fd)
1922
{
2023
int flags;

networking/03 Multiplexed echo-server/3_kqueue_server.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#define PORTNUM 1500 // Port > 1024 because program will not work not as root.
1414

15+
// Compile:
16+
// g++ -std=c++11 3_kqueue_server.cpp -o kqueue_server
17+
1518
int set_nonblock_mode(int fd)
1619
{
1720
int flags;

0 commit comments

Comments
 (0)