ios - CFNetwork unexpectedly closes http connection -
i facing strange issue cfnetwork
on ios simulator , on ios device.
i sending http requests remote server. sometimes, works correctly. cfnetwork
opens socket remote server, sends http request in 1 packet , sends fin packet (after 1ms).
i don't see issue on mac os x, run similar code.
stream created cfreadstreamcreateforstreamedhttprequest()
, put cfrunloop
. if issue occurs, run-loop reports kcfstreameventopencompleted
, subsequently reports kcfstreameventerroroccurred
enotconn error.
it seems code behaves more stable if call:
cfwritestreamsetclient(stream, kcfstreameventnone, null, null);
before:
cfwritestreamunschedulefromrunloop(stream, ...);
it seems setting of empty client before stream unscheduled resolved hardly explain issues cfnetwork. maybe streams generating events after should cleaned up.
Comments
Post a Comment