|
@@ -1,6 +1,7 @@
|
|
|
#include "socketio.hpp"
|
|
|
#include <iostream>
|
|
|
#include <exception>
|
|
|
+#include <random>
|
|
|
template<typename T>
|
|
|
std::ostream& operator<<(std::ostream& out, std::vector<T> o){
|
|
|
out << "(";
|
|
@@ -20,12 +21,18 @@ std::ostream& operator<< <char>(std::ostream& out, std::vector<char> o){
|
|
|
return out;
|
|
|
}
|
|
|
int main(){
|
|
|
+ std::uniform_int_distribution<unsigned char> dis(0,20);
|
|
|
+ std::mt19937_64 gen;
|
|
|
server_socket ssock(80);
|
|
|
while(true){
|
|
|
cppsocket sock = ssock.accept_connection();
|
|
|
try{
|
|
|
std::vector<char> vec = sock.receive();
|
|
|
- sock.write("Hallo Velo\n");
|
|
|
+ std::string resp(100, 'a');
|
|
|
+ for(unsigned int i = 0;i < resp.size();i++){
|
|
|
+ resp[i] = dis(gen) + 'a';
|
|
|
+ }
|
|
|
+ sock.write("Hallo " + resp);
|
|
|
sock.close();
|
|
|
}
|
|
|
catch(std::exception& e){
|