This commit is contained in:
Nishi 2026-01-29 15:23:28 +09:00
commit 6a68ba0bd0
Signed by: nishi
GPG key ID: 27EF69B208EB9343
7 changed files with 78 additions and 8 deletions

View file

@ -1 +1,26 @@
#include <GearSrc/Net.h>
#include <GearSrc/Log.h>
GSNetClient GSNetClientOpen(GSClient client, const char* hostname, int port) {
GSNetClient net = malloc(sizeof(*net));
memset(net, 0, sizeof(*net));
net->engine = client->engine;
if((net->fd = GSNetBaseClient(hostname, port)) < 0) {
GSLog(client->engine, GSLogError, "Failed to initialize socket");
GSNetClientClose(net);
return NULL;
}
return net;
}
void GSNetClientClose(GSNetClient client) {
if(client->fd >= 0) GSNetBaseClose(client->fd);
free(client);
}