summaryrefslogtreecommitdiff
path: root/src/netcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/netcode.c')
-rw-r--r--src/netcode.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/netcode.c b/src/netcode.c
index 5ae5990..3b77fa5 100644
--- a/src/netcode.c
+++ b/src/netcode.c
@@ -81,9 +81,15 @@ netcode_deinit(void)
}
int
-netcode_send(void *data, size_t size)
+netcode_host(void)
{
- if (SDLNet_TCP_Send(_sock_other, data, size) < 0) {
+ return (_sock_host != NULL);
+}
+
+int
+netcode_send(void *data, int size)
+{
+ if (SDLNet_TCP_Send(_sock_other, data, size) != size) {
log_error("%s", SDLNet_GetError());
return -1;
}
@@ -91,9 +97,9 @@ netcode_send(void *data, size_t size)
}
int
-netcode_recv(void *data, size_t size)
+netcode_recv(void *data, int size)
{
- if (SDLNet_TCP_Recv(_sock_other, data, size) < 0) {
+ if (SDLNet_TCP_Recv(_sock_other, data, size) != size) {
log_error("%s", SDLNet_GetError());
return -1;
}