From a270b0483c2b98e7570a1f78d2d42ceddf1e8c73 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 2 Aug 2007 01:45:41 -0700 Subject: [PATCH] * Source/SocketWrapper.m: Include to remove some implicit function definition warnigns and implement send: ([SocketWrapper send:]): Implemented method --- Source/SocketWrapper.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/SocketWrapper.m b/Source/SocketWrapper.m index d1c1d28..b193eee 100644 --- a/Source/SocketWrapper.m +++ b/Source/SocketWrapper.m @@ -19,6 +19,7 @@ #include #include #include +#include @implementation SocketWrapper @@ -142,7 +143,17 @@ */ - (void)send: (NSString *)data { - // TODO - implement me + data = [NSString stringWithFormat: @"%@\0", data]; + int sent = send(_socket, [data UTF8String], [data length], 0); + if (sent < 0) + { + NSLog(@"error in sending"); + } + if (sent < [data length]) + { + // TODO - do we really need to worry about partial sends with the lenght of our commands? + NSLog(@"FAIL: only partial packet was sent; sent %d bytes", sent); + } } @end -- 2.22.5