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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759413036, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/C-C-plus-plus/Socket_cpp/examples(54): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78