Search notes:

Examples for Socket.cpp

simple client connects to www.renenyffenegger.ch, port 80, and GETs its front page.
echo server opens a port on 2000 and waits for incoming connections. Each connection is answered with the same line as was written (echoed).
proxy listens on a specified port and relays income traffic to a specified server/port.
message distributor distributes messages to any number of clients.

Compiling

compile.ming.bat

With Mingw, the examples can be compiled with the following bat file:
g++ -c  ../src/Socket.cpp       -o Socket.o
g++ -I../src simple-client.cpp     Socket.o -lwsock32 -o simple-client.exe
g++ -I../src echo-server.cpp       Socket.o -lwsock32 -o echo-server.exe
g++ -I../src proxy.cpp             Socket.o -lwsock32 -o proxy.exe
g++ -I../src msg-distributor.cpp   Socket.o -lwsock32 -o msg-distributor.exe
Github repository Socket.cpp, path: /examples/compile.ming.bat

Index