Adds documentation for client and server
This commit is contained in:
parent
5b1648e471
commit
031905ab5e
1 changed files with 6 additions and 0 deletions
|
@ -174,6 +174,7 @@ void bstr(unsigned int n, char **out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts a server that listens for commands and performs calculations
|
/// Starts a server that listens for commands and performs calculations
|
||||||
|
/// @return 0 on success <0 on failure
|
||||||
int server() {
|
int server() {
|
||||||
struct sockaddr_storage c_addr;
|
struct sockaddr_storage c_addr;
|
||||||
socklen_t sin_size = sizeof c_addr;
|
socklen_t sin_size = sizeof c_addr;
|
||||||
|
@ -218,8 +219,11 @@ int server() {
|
||||||
}
|
}
|
||||||
close(c_fd);
|
close(c_fd);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Connects the client to the server
|
||||||
|
/// @return 0 on success <0 on failure
|
||||||
int connectclient(struct addrinfo *ainfo) {
|
int connectclient(struct addrinfo *ainfo) {
|
||||||
if (connect(SOCKFD, ainfo->ai_addr, ainfo->ai_addrlen) == -1) {
|
if (connect(SOCKFD, ainfo->ai_addr, ainfo->ai_addrlen) == -1) {
|
||||||
perror("connect");
|
perror("connect");
|
||||||
|
@ -228,6 +232,8 @@ int connectclient(struct addrinfo *ainfo) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Starts a client
|
||||||
|
/// @return 0 on success -1 on failure
|
||||||
int client() {
|
int client() {
|
||||||
char buf[BUFLEN];
|
char buf[BUFLEN];
|
||||||
size_t nullsize = 0;
|
size_t nullsize = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue