[En-Nut-Discussion] Receiving data problem

Ulrich Hertlein ulrich.hertlein at artcom.de
Mon Jan 22 12:41:25 CET 2007


MUHAMMAD AZEEM AZAM wrote:
> i am unable to sent 2d ARRAY TO MY CLIENT ON PC.
>   the code is below.
>   I have to use tcp sockets.
>   i need to send "char var[1024][128]" this array. 
>   "char var[4][128]" this thing is working but after that my client application hangs.
>    
>   if (strncmp(buff, "2darray", got_data) == 0) //If Match 
>  {
>   int a = 5;
>   int b = 128;
>   char mvar[a][b];
>   char mvarr[128];

When using variables like that you're allocating from the stack.
It's possible you're overwriting your stack and thereby messing up your app.

Try using malloc to allocate from the heap and see if it makes a difference.

/Ulrich

-- 
Ulrich Hertlein | Software Development

ART+COM AG
Kleiststr. 23-26 | 10787 Berlin | Germany

phone: +49.30.21001-433
fax:   +49.30.21001-555
http://www.artcom.de



More information about the En-Nut-Discussion mailing list