Minor update to C examples

This commit is contained in:
Joseph Henry
2021-05-06 01:34:53 -07:00
parent 2c666894b6
commit 613c7e8f91
4 changed files with 22 additions and 24 deletions

View File

@@ -89,13 +89,13 @@ int main(int argc, char** argv)
char recvBuf[128] = { 0 };
printf("Reading message string from client...\n");
if ((bytes = zts_bsd_read(accfd, recvBuf, sizeof(recvBuf))) < 0) {
if ((bytes = zts_read(accfd, recvBuf, sizeof(recvBuf))) < 0) {
printf("Error (fd=%d, ret=%d, zts_errno=%d). Exiting.\n", fd, bytes, zts_errno);
exit(1);
}
printf("Read %d bytes: %s\n", bytes, recvBuf);
printf("Sending message string to client...\n");
if ((bytes = zts_bsd_write(accfd, recvBuf, bytes)) < 0) {
if ((bytes = zts_write(accfd, recvBuf, bytes)) < 0) {
printf("Error (fd=%d, ret=%d, zts_errno=%d). Exiting.\n", fd, bytes, zts_errno);
exit(1);
}
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
// Close
printf("Closing sockets\n");
err = zts_bsd_close(accfd);
err = zts_bsd_close(fd);
err = zts_close(accfd);
err = zts_close(fd);
return zts_node_stop();
}