Client: #include #include "xyssl/net.h" #include "xyssl/net.c" #define MAX_MSG 100 #define LINE_ARRAY_SIZE (MAX_MSG+1) using namespace std; int main() { char* h = "127.0.0.1"; int p = 8080; int fd = 0; char buf[LINE_ARRAY_SIZE], c; int socket = net_connect(&fd, h, p); if (socket != 0) { cout << "ow it dont work"; } else { cout << "Input: "; cin.get(buf, MAX_MSG, '\n'); if (send(socket, buf, strlen(buf) + 1, 0) < 0) { cout << "cannot send data "; net_close(socket); exit(1); } } net_close(socket); } ______________________________________________________________________________________ Server: #include #include "xyssl/net.h" #include "xyssl/net.c" #define MAX_MSG 100 #define LINE_ARRAY_SIZE (MAX_MSG+1) using namespace std; int main() { char* h = "127.0.1.1"; int p = 8080; int fd = 0; int socket = net_bind(&fd, NULL, p); char line[LINE_ARRAY_SIZE]; while (socket == 0) { memset(line, 0x0, LINE_ARRAY_SIZE); while (recv(socket, line, MAX_MSG, 0) > 0) { cout << line << "\n"; memset(line, 0x0, LINE_ARRAY_SIZE); // set line to all zeroes } } net_close(socket); }