Trouble at receiving messages with the asyncsocket objective c
===

I am newbie at objective C and I have an assignment at an intern project. I tried to implement a tcp listener for iOS using asyncSocket. I used a little bit of echo server example and tried to implement a listener.however, i don't know why i can't receive messages over network.  What am I doing wrong?
This is my header file:

    #import <Foundation/Foundation.h>
    #import "AsyncSocket.h"
    #import "Device.h"
    @class AsyncSocket;
    @interface TCPConnection : NSObject{
       
    	
    	
    	BOOL isRunning;
    	
        IBOutlet id portField;
        IBOutlet id startStopButton;
    }
    -(void)listen;
    @property (copy,nonatomic) NSMutableArray *devList;
    @end





end this my class:

    #import "TCPConnection.h"
    #import <CFNetwork/CFNetwork.h>
    #define WELCOME_MSG  0
    #define ECHO_MSG     1
    #define WARNING_MSG  2
    
    #define READ_TIMEOUT 15.0
    #define READ_TIMEOUT_EXTENSION 10.0
    
    #define FORMAT(format, ...) [NSString stringWithFormat:(format), ##__VA_ARGS__]
    
    
    @implementation TCPConnection
    @synthesize devList;
    
    - (void) listen{
        
        AsyncSocket *sock = [[AsyncSocket alloc] initWithDelegate:self];
        UInt16 port = 9600;
        NSError *error = nil; 
        [sock acceptOnPort:port error:&error];
        [sock readDataToData:[AsyncSocket CRLFData] withTimeout:-1 tag:1];
        
        NSData *strData = [[AsyncSocket CRLFData] subdataWithRange:NSMakeRange(0, [[AsyncSocket CRLFData] length]-2)];
        NSString *msg = [[NSString alloc] initWithData:strData encoding:NSUTF8StringEncoding];
      
        @try {
            if(msg){
                Device *ret =[[Device alloc] init];
                NSRange range = [msg rangeOfString:@" "];
                NSString *substring = [[msg substringFromIndex:NSMaxRange(range)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
                ret.id = substring;
                substring = [[msg substringToIndex:NSMaxRange(range)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
                ret.ip = substring;
                [devList addObject:ret];    
            }
    
        }
        @catch (NSException *exception) {
            NSLog(@"There are no answers received");
        }
       
            
    }
    
    
    
    
    - (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port
    {
    		
    	NSString *welcomeMsg = @"Welcome to the AsyncSocket Echo Server\r\n";
    	NSData *welcomeData = [welcomeMsg dataUsingEncoding:NSUTF8StringEncoding];
    	
    	[sock writeData:welcomeData withTimeout:-1 tag:WELCOME_MSG];
    	
    	[sock readDataToData:[AsyncSocket CRLFData] withTimeout:READ_TIMEOUT tag:0];
    }
    
    - (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag
    {
    	if(tag == ECHO_MSG)
    	{
    		[sock readDataToData:[AsyncSocket CRLFData] withTimeout:READ_TIMEOUT tag:0];
    	}
    }
    
    
    /**
     * This method is called if a read has timed out.
     * It allows us to optionally extend the timeout.
     * We use this method to issue a warning to the user prior to disconnecting them.
     **/
    - (NSTimeInterval)onSocket:(AsyncSocket *)sock
      shouldTimeoutReadWithTag:(long)tag
    				   elapsed:(NSTimeInterval)elapsed
    				 bytesDone:(NSUInteger)length
    {
    	if(elapsed <= READ_TIMEOUT)
    	{
    		NSString *warningMsg = @"Are you still there?\r\n";
    		NSData *warningData = [warningMsg dataUsingEncoding:NSUTF8StringEncoding];
    		
    		[sock writeData:warningData withTimeout:-1 tag:WARNING_MSG];
    		
    		return READ_TIMEOUT_EXTENSION;
    	}
    	
    	return 0.0;
    }
    
    - (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
    {
    	NSData *strData = [data subdataWithRange:NSMakeRange(0, [data length] - 2)];
    	NSString *msg = [[NSString alloc] initWithData:strData encoding:NSUTF8StringEncoding];
    	if(msg)
    	{
    		NSLog(@"%@",msg);
    	}
    	else
    	{
    		NSLog(@"Error converting received data into UTF-8 String");
    	}
    	
    	// Even if we were unable to write the incoming data to the log,
    	// we're still going to echo it back to the client.
    	[sock writeData:data withTimeout:-1 tag:ECHO_MSG];
    }
    
    
    @end

