-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
48 lines (29 loc) · 1.33 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
socketstream is a header-only library for socket I/O.
The following classes are defined:
swoope::socketbuf:
An std::streambuf derived class that implements a raw socket
device.
swoope::socketstream:
An std::iostream derived class that implements high-level
stream input/output on a swoope::socketbuf.
socketstream works with POSIX and Windows. Compatible with C++03,
move semantics enabled for C++11.
Author: Mark Swoope
Date: July 2017
Compiling and running the examples:
If you are using the Visual C++ compiler, the commands:
cl /EHsc server_example.cc ws2_32.lib
cl /EHsc client_example.cc ws2_32.lib
should compile the example programs when issued from a Developer Command Prompt for VS.
If you are using the MinGW compiler, then the commands would be:
g++ -D _WIN32 -o server_example.exe server_example.cc -lws2_32
g++ -D _WIN32 -o client_example.exe client_example.cc -lws2_32
For Linux and Mac, the commands are:
g++ -o server_example.exe server_example.cc
g++ -o client_example.exe client_example.cc
(.exe extention is optional for Linux and Mac)
After compiling successfully, to test the programs first run:
server_example.exe 6789
in one terminal window, then run
client_example.exe localhost 6789
In another terminal window and begin entering lines of text into the client terminal window to see the server echo them back.