commit fe62b8a97539316c459d0726383660b2e351ddb9
parent f08ce15036f28d3b846c5cda72ca44c5e4bfe28b
Author: Yersa Nordman <yersa@finwo.nl>
Date: Wed, 26 Jul 2023 22:30:26 +0200
Re-added port to connect method
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/fnet.c b/src/fnet.c
@@ -47,18 +47,24 @@ struct fnet_t * fnet_listen(const char *address, uint16_t port, struct fnet_conn
return NULL;
}
-struct fnet_t * fnet_connect(const char *address, struct fnet_connect_options_t *options) {
+struct fnet_t * fnet_connect(const char *address, uint16_t port, struct fnet_connect_options_t *options) {
// Checking arguments are given
if (!address) {
fprintf(stderr, "fnet_connect: address argument is required\n");
return NULL;
}
+ if (!port) {
+ fprintf(stderr, "fnet_listen: port argument is required\n");
+ return NULL;
+ }
if (!options) {
fprintf(stderr, "fnet_connect: options argument is required\n");
return NULL;
}
+
+
return NULL;
}
diff --git a/src/fnet.h b/src/fnet.h
@@ -42,7 +42,7 @@ struct fnet_connect_options_t {
};
struct fnet_t * fnet_listen(const char *address, uint16_t port, struct fnet_connect_options_t *options);
-struct fnet_t * fnet_connect(const char *address, struct fnet_connect_options_t *options);
+struct fnet_t * fnet_connect(const char *address, uint16_t port, struct fnet_connect_options_t *options);
void fnet_process(struct fnet_t *connection);
void fnet_write(struct fnet_t *connection, struct buf *buf);