tags:

views:

63

answers:

0

HI all,

I have a issue that when I try to write some bytes in the outputstream, I am getting the bad access. The code is as follows :

int writtenBytes = [_os write:[packetInBytes bytes] maxLength:lengthOfPacket];  

where the "packetInBytes" points to NSData and "lengthOfPacket" corresponds to the data length, and _os represents the NSOutputStream.

The call stack from the debugger is as follows :

#0  0xffff0269 in __spin_lock
#1  0x302a6098 in CFSocketDisableCallBacks
#2  0x003b46d0 in SocketStream::write
#3  0x302402c3 in CFWriteStreamWrite
#4  0x0001b423 in -[Writer write:] at Writer.m:96
#5  0x0001b5ef in -[Writer run] at Writer.m:111
#6  0x3050a79d in -[NSThread main]
#7  0x3050a338 in __NSThread__main__
#8  0x91a27fe1 in _pthread_start
#9  0x91a27e66 in thread_start

I am not getting this issue always. I get this issue execute my code for some 5 or more times ... I have checked all the params that i pass to the write function have its values and not nil.

Any help would be greatly appreciated

Best Regards, MOhammed Sadiq.