[prog] Segmentation fault :-(

Sujita Purushothaman sujita at mimos.my
Tue Sep 24 15:51:37 EST 2002


Sujita Purushothaman wrote:

>
> The main program runs like this :
>
>  if (GetStatus() != SOCK_HS_SUCCESS)
>                 return BaseSocket::Receive(data, dataLen, flags);
>
> And the declaration for Receive is :
> int BaseSocket::Receive(unsigned char *buff, int len, int flags)
> {
>         return recv(sd, buff, len, flags);
> }
>
> (I hate functions that do nothing but call other functions!!)
> recv is a standard SSL function, I think?
>
> Execution doesn't enter BaseSocket::Receive;  when I put a printf
> before the "return recv(sd, buff, len,flags) line, it doesn't get printed;
> Segfault happens before that. And a printf just before the line
> return BaseSocket::Receive(data,dataLen,flags) prints.
>
> Could it be that calling the method Receive requires some memory
> which causes the segfault? the variable 'data' is very large, about 66,000.

I forgot to add :
the declaration for data is :
unsigned char data[65535];

Thanks,
Sujita






More information about the Programming mailing list