Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Tester2AppDelegate.m
- // Tester2
- //
- // Created by Dylan Lukes on 11/7/10.
- // Copyright 2010 Dylan Lukes. All rights reserved.
- //
- #import "Tester2AppDelegate.h"
- #import "MHPacketDecoder.h"
- #import "NSStream+MHUtilities.h"
- @implementation Tester2AppDelegate
- @synthesize window;
- - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- // Initialize on another thread:
- packetDecoder = [[MHPacketDecoder alloc] init];
- NSOutputStream *outStream = [packetDecoder getOutputStream];
- [packetDecoder setDelegate:self];
- [outStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
- [outStream open];
- [outStream write:&(uint8_t){0x01} exactLength:sizeof(int8_t)];
- [outStream write:(uint8_t *)&(int32_t){OSSwapHostToBigInt32(0x02)} exactLength:sizeof(int32_t)];
- [outStream write:(uint8_t *)&(int16_t){OSSwapHostToBigInt16(0x08)} exactLength:sizeof(int16_t)];
- [outStream write:(uint8_t *)"revenant" exactLength:8];
- [outStream write:(uint8_t *)&(int16_t){OSSwapHostToBigInt16(0x08)} exactLength:sizeof(int16_t)];
- [outStream write:(uint8_t *)"password" exactLength:8];
- [outStream write:(uint8_t *)&(int64_t){OSSwapHostToBigInt64(0x03)} exactLength:sizeof(int64_t)];
- [outStream write:&(uint8_t){0x04} exactLength:sizeof(int8_t)];
- [pool drain];
- }
- - (void)packetDecoder:(id)sender didNotDecodePacket:(NSData *)packet{
- return;
- }
- - (void)packetDecoder:(id)sender didDecodeLoginRequest:(int32_t)protocolVersion username:(NSString *)username password:(NSString *)password mapseed:(int64_t)mapseed dimension:(int8_t)dimension{
- NSLog(@"Parsed login");
- }
- @end
Add Comment
Please, Sign In to add comment