project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m
branchios-revival
changeset 11240 57891137ffef
parent 11137 14f50dde3e8c
child 12872 00215a7ec5f5
equal deleted inserted replaced
11239:a954853e9c00 11240:57891137ffef
    67 
    67 
    68 #pragma mark -
    68 #pragma mark -
    69 #pragma mark Communication layer
    69 #pragma mark Communication layer
    70 -(int) sendToServer:(NSString *)command {
    70 -(int) sendToServer:(NSString *)command {
    71     NSString *message = [[NSString alloc] initWithFormat:@"%@\n\n",command];
    71     NSString *message = [[NSString alloc] initWithFormat:@"%@\n\n",command];
    72     int result = SDLNet_TCP_Send(self.ssd, [message UTF8String], [message length]);
    72     int result = SDLNet_TCP_Send(self.ssd, [message UTF8String], [message lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
    73     [message release];
    73     [message release];
    74     return result;
    74     return result;
    75 }
    75 }
    76 
    76 
    77 -(int) sendToServer:(NSString *)command withArgument:(NSString *)argument {
    77 -(int) sendToServer:(NSString *)command withArgument:(NSString *)argument {
    78     NSString *message = [[NSString alloc] initWithFormat:@"%@\n%@\n\n",command,argument];
    78     NSString *message = [[NSString alloc] initWithFormat:@"%@\n%@\n\n",command,argument];
    79     int result = SDLNet_TCP_Send(self.ssd, [message UTF8String], [message length]);
    79     int result = SDLNet_TCP_Send(self.ssd, [message UTF8String], [message lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
    80     [message release];
    80     [message release];
    81     return result;
    81     return result;
    82 }
    82 }
    83 
    83 
    84 -(void) serverProtocol {
    84 -(void) serverProtocol {