Help with passing integer poniter to function



Hi,

I am having strange problem in my Program.

I cannot paste the whole program as it is huge so just pasting the
lines i think are necessary.

I am passing a integer array pointer to a function.

**********

int sockets[MAX_TCPCLIENTS]; /* an array of connected sockets*/
......
......
fprintf(stderr,"The value is %d",sockets);

accept_new_tcp_client(sockets,&readset,listenfd);
.......
.......
void accept_new_tcp_client(int *sockets, fd_set *readset, int listenfd)
{
struct sockaddr *signaddr;
int addrlength;
int i;
int clientsockfd;
addrlength = sizeof(signaddr);

fprintf(stderr,"\nThe value is %d",sockets);

/*== First accept the new connection ==*/

if((clientsockfd = accept(listenfd,(struct
sockaddr*)&signaddr,&addrlength))<0)
{
printf("\nSome Problem with accepting connection");
exit(EXIT_FAILURE);
}

fprintf(stderr,"\nAccepted a new Client connection");

fprintf(stderr,"\nThe value is %d",sockets);

********
The print output is

.....
The value is 12643936
The value is 12643936
Accepted a new Client connection
The value is 0Segmentation fault (core dumped)


Can anyone explians whats happening???

Cheers
Vishal

.



Relevant Pages

  • Re: Help with passing integer poniter to function
    ... I am having strange problem in my Program. ... struct sockaddr *signaddr; ... int addrlength; ... Accepted a new Client connection ...
    (comp.lang.c)
  • [NT] Dark Age of Camelot Man-In-The-Middle
    ... use of RSA public key cryptography and an RC4 based symmetric algorithm. ... Seeing the imminent release of code for cracking the game client (which ... At the beginning of each TCP session, the server sends a 1536 bit RSA ... void bytes_out(unsigned char *data, int len) ...
    (Securiteam)
  • up-imapproxy DoS vulnerabilities
    ... up-imapproxy is an IMAP proxy which keeps connections open after client has ... and reuses it when client connects back. ... There are various bugs in up-imapproxy which can crash it. ... unsigned int ReadBytesProcessed; /* bytes already processed in read buf */ ...
    (Bugtraq)
  • Re: Problem with SslStream when using Windows Vista
    ... The code for the server & client follow. ... private int _port = 0; ... // SslStream using the client's network stream. ...
    (microsoft.public.dotnet.framework)
  • Re: program hang on send() ??
    ... Why would you expect a perfectly healthy, 100% working connection to ... these are *NOT* operation timeouts. ... client didn't hang on send, ... int main ...
    (comp.os.linux.networking)