// main.c #include #include #include #include #include "error.h" #include "sock.h" int main(void) { enum error_t err = ERR_OK; int sock; err = sock_init(&sock); if (err) goto handle_error; char ibuf[1028] = { 0 }; char obuf[1028] = { 0 }; strcpy(obuf, "Hello, world!\n"); // Just echoing everything back for now write(sock, obuf, 1028); int rc = read(sock, ibuf, 1028); if (rc > 0) printf("%s", ibuf); close(sock); return ERR_OK; handle_error: printf("ERROR: %s\n", ERROR_STRS[err]); return err; }