I wrote a windows phone 8 app that using StreamSocket class, but found a strange situation. My code is as below
async void Connect() {
await StreamSocketConnect();
TryToSendAsync();
ReceiveAsync();
}
async void ReceiveAsync() {
//WriteLine("111");
await DataReader.LoadAsync();
//WriteLine("222");
DoReceiverCallBack();
}
async void TryToSendAsync(){
await DataWriter.StoreAsync();
}
void DoReceiveCallBack() {
//WriteLine("333");
ReceiveAsync();
//WriteLine("444");
}
In sequence, it should follow 333 => 111 => 444 => 222, but sometime I will get 333 => 111 => 222 => 444 while receiving data especially. Will it be synchronous sometimes??