rendered paste bodyClient:
#include <stdio.h>
#include <xyssl/net.c>
int main() {
int fd, connection, send;
char *host = "localhost";
int port = 3000;
if ((connection = net_connect(&fd, host, port)) != 0) {
printf("error!");
goto exit;
}
char data = "Hi";
int som;
if ((send = net_send(&som, &data, sizeof(data))) != 0) {
printf("Cannot send data");
printf(send);
goto exit;
}
net_close(connection);
exit:
return 0;
}
Server:
#include <stdio.h>
#include <xyssl/net.c>
int main() {
int fd, bind, accept, recv;
char *host = "localhost";
int port = 3000;
if ((bind = net_bind(&fd, host, port)) != 0) {
printf("error! cannot bind");
goto exit;
}
int client_fd = -1;
if (accept = net_accept(fd, &client_fd, NULL) != 0) {
printf("cannot accept :(");
goto exit;
}
char data = "Hi";
int som;
if (recv = net_recv(&som, &data, sizeof(data)) != 0) {
printf("Cannot recv!");
printf(recv);
goto exit;
}
exit:
return 0;
}