I made an iPhone client connect to the server using GCDAsyncSocket. The server runs .Net on a Windows server. The connection is good and it also sends data.
Then I give the client the opportunity to receive immediately after sending ...
[sock readDataToData:[GCDAsyncSocket LFData] withTimeout:15 tag:1];
I also have this setting for receiving:
- (void)onSocket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
and:
- (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag
If I wait for a timeout, the timeout method is called.
If I send data from the server, the timeout is not called, so I assume the client saw something, but there is no indication that the client side.
I also added:
- (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength: (NSUInteger)partialLength tag:(long)tag
I hope I see a partial package, but it will not be called or.
As I mentioned above, the timeout does not work if I send something from server to client. However, I would have thought it would also time out if he didn't get a character terminator. I also tried reading with a length of 3, but it didnt anyway.
GCDAsyncSocket problem. AsyncSocket is working fine.
Maybe its initiator is wrong?
dispatch_queue_t mainQueue = dispatch_get_main_queue ();
asyncSocket = [[GCDAsyncSocket alloc] initWithDelegate: self delegateQueue: mainQueue]
Any ideas what I did wrong?
I put a message in goggle code for this, but there is no activity, so I'm not sure if I will get a response or not.
Ideally, if someone has an example of code that gets working, that would be great! thanks!