wrote:
> HI,
>
>
>> If my assumptions are correct [above], then I would *guess* that
>> something's screwing up the stack in your call to 'accept()' - if
>> you comment that out, the fprintf works ok?
>
> Yes you are right if i comment the accept() function it works fine.
> So i really cant figure out whats happeing to the stack here.
> Why the address of sockets is being lost.
>
>
>> In the call to accept(), you're casting signaddr to a 'struct
>> sockaddr *' - which it already is ... struct sockaddr *signaddr
>
> I have tried passing signaddr without casting , but still giving the
> same problem.
> ****
> if((clientsockfd = accept(listenfd,&signaddr,&addrlength))<0)
> {
> printf("\nSome Problem with accepting connection");
> exit(EXIT_FAILURE);
> }
> ***
>
>
>> But, you're passing a struct sockaddr ** by using &signaddr.
>
> I am working on Cygwin here. Can that be a problem. As when i used to
> work on Solaris as far as i remember this did not
> gave any problem.
Well, you're now getting into the 'off topic slap' area here, so best be
brief ...
From the docs I've found ...
int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
You shouldn't be passing a ** but a *, so change your code to:
if((clientsockfd = accept(listenfd, signaddr, &addrlength)) < 0)
I.e., no *&* on signaddr - and remove the cast.
--
==============
Not a pedant
==============