1
Reply

allocating memory at run time

jeevan mummadi

jeevan mummadi

May 8 2008 5:21 AM
1.6k

hello,  i have declared byte[] at runtime by allocating some memory.(socket programming)

     

public void OnDataReceived(IAsyncResult asyn)

{

CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState;

try

{

int iRx = 0;

conn_arr = "*0001";

conn_arr1 = "*0001#\0";

//iRx = theSockId.thisSocket.EndReceive(asyn);

iRx = theSockId.m_currentSocket.EndReceive(asyn);

byte[] power = new byte[iRx] ;

--

--

--

}

-> power is getting allocated for 1024 bytes,but i want to allocate only for the no of bytes received(iRx).


Answers (1)