Im encountering some serious problems with my TcpClient code, that
communicates between two or more iPhones. I've spent the last two days
trying to figure out an exact scenario of where things go wrong and I cant.
Each time I run it, I get a different outcome. The way I go about the
transfer is as follows:
At the sender's side I write, say 10,000 bytes to the TcpClient.GetStream()
network stream. This returns with no errors.
At the other end I use BeginRead(), which reads 12 bytes first (the length
prefixes), then reads the header & payload. All the receive methods
continually check the bytes read value and re-call the BeginRead method as
necessary until all data has been received.
This can all work fine now and then, but sometimes (about 1 in 5 read
attempts) I need to call BeginRead again. I do this, but it never calls back
into EndRead. Well it might after about 15 minutes. I've even had scenarios
where I perform the send, and maybe another 20 sends after it, then close
the sending app, and about 10-15 minutes later all the receives suddenly
appear on the client.
This obviously suggests that the problem is on the receiving/client end. It
suggests that the data has already arrived at the client, but the framework
hasn't called the EndRead callback. However, if more than one client socket
is being managed by the host app/device, the problem is far worse, generally
one client will exhibit the huge delay issue, and the other one will be
almost in real-time. This is very strange, as there isn't any way that
client 1 can know client 2 is connected, yet it still seems to affect it.
This problem points at the sending being the problem. So with just the two
examples above, I cannot determine if it's the sending or receiving code is
at fault. I've tried to use WireShark to monitor the data, but cannot figure
out how to do this on WiFi.
Has anyone encountered any similar problems with TcpClient/Socket code?
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Serious-strange-problems-with-Sockets-TcpClient-tp4595780p4595780.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch