The more I dig into this, the more it seems to be either an iOS problem, or 
merely the way the devices (and possibly Windows etc as well) work.

I've switched from TcpClient to Socket, because unlike the TcpClient's void 
Write method, the Socket's Send method returns the number of bytes written so 
am hoping that might help - however, if it returns the number of bytes written 
to the iOS network buffer, then I am no better off, and it's an iOS issue 
whereby that packet of data just never arrives, and I have no way of knowing.

Dino

From: [email protected] 
[mailto:[email protected]] On Behalf Of Dean Cleaver
Sent: Tuesday, November 22, 2011 9:46 PM
To: Forums, MonoTouch ([email protected])
Subject: [MonoTouch] Anyone experiencing some "strange" network problems?

Hi,

I'm experiencing some unusual network behaviour that I can't work out. In 
short, my app communicates with the server either via web services or TCP-IP 
calls, depending on the process. Some processes have mixed calls.

What I am seeing in one case is the web service call works and then it proceeds 
to make a TCP-IP call, which reports that it worked too - however it didn't 
work. The code below returns "true" so I know all checks passed, and no 
exceptions occurred, but the TCP-IP data never makes it to the server.

This can be proven by turning 3G off, and walking outside wireless network 
range so I have no connectivity at all - is it the iPhone reporting success in 
sending the message, or MonoTouch? How can I get it to fail like it should?

Dino


try

{

    if (this.clientStream == null)

    {

        if (this.stopClient)

            return false;



        this.Continue(5);



        if (this.clientStream == null)

            return false;

    }



    if (!this.clientStream.CanWrite)

        return false;



    if (message == null)

        return false;



    this.clientStream.Write(message, 0, message.Length);

    return true;

}

catch (NullReferenceException)

{

    return false;

}

catch (ObjectDisposedException)

{

    return false;

}

catch (IOException)

{

    return false;

}

catch (Exception ex)

{

    this.SendError(ex, "Error in SendMessage byte[]");

    return false;

}


_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to