AsyncSocket writeData issue
<p>I am connecting to a server socket using the following code:</p>

<pre><code>- (void)viewDidLoad {
    [super viewDidLoad];
    asyncSocket = [[AsyncSocket alloc] initWithDelegate:self];

    NSError *err = nil;
    //[asyncSocket connectToHost:@"192.168.0.200" onPort:8000 error:&amp;err];
    if(![asyncSocket connectToHost:@"192.168.0.78" onPort:2055 error:&amp;err])
    {
        [asyncSocket connectToHost:@"192.168.0.78" onPort:2055 error:&amp;err];
    }
}
</code></pre>

<p>Then in the didConnectToHost delegate, i am writing few text:</p>

<pre><code>- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port
{
    NSLog(@"onSocket:%p didConnectToHost:%@ port:%hu", sock, host, port);

    for(int i=0;i&lt;5;i++){
        NSString* str= [NSString stringWithFormat: @"Hello Server: %d",i];
        NSData* data=[str dataUsingEncoding:NSUTF8StringEncoding];
        [sock writeData:data withTimeout:-1 tag:1];

    }
}
</code></pre>

<p>When I connect to the socket, the connected message is displayed on the server side console. On the server side, the data is being read from the stream with streamReader. We are using TCPListener class on the server side(c# .Net). But when I write data from the client side socket, and try to read the data sent by client, streamReader object on the server is getting empty data. When we quit the client application, the streamReader object in the server side is getting the data which was sent by the client.</p>

<p>We need to read the data at server side immediately after writing from the client side rather than quitting the application.</p>

<p>Can anyone help me to solve this issue? </p>
