From: Bill Cunningham on

"Ian Collins" <ian-news(a)hotmail.com> wrote in message
news:85dvg9F47oU1(a)mid.individual.net...

[...]
> Using functions at random are we?

Well I didn't think it would hurt to have it there. And it doesn't.
Somewhere else in the operation of the program is a bug and error checking
doesn't seem to be helping me. I've tried all I know. I hate to be defeated
like this but not suprised. Wait til I get into the Stevens book deep.

BIll


From: Bill Cunningham on

"Scott Lurndal" <scott(a)slp53.sl.home> wrote in message
news:nKjIn.307794$KH2.262040(a)news.usenetserver.com...
[...]

> hint: man getaddrinfo, and pay special attention to the node argument.

Oh no no not there man I know those parameters in my sleep. What do I do
with the core dump use gdb? Aw let me see...

Bill


From: John Gordon on
In <4bf1bfb1$0$12459$bbae4d71(a)news.suddenlink.net> "Bill Cunningham" <nospam(a)nspam.invalid> writes:


> All I get when I add main() and call the client() function is a sstring of
> decimals.

Wait, so the program is working now? You don't get a seg fault anymore?

In any case, I compiled and ran your code and did not get a segfault.
I got a zero printed on the output, just as expected.

> And I also include the header func.h that I wrote that defines this.
> int client(char *, char *);

It really helps if you can post a complete example of your code all
at once, rather than feeding us little bits and pieces like this.

--
John Gordon A is for Amy, who fell down the stairs
gordon(a)panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

From: Scott Lurndal on
"Bill Cunningham" <nospam(a)nspam.invalid> writes:
>
>"Scott Lurndal" <scott(a)slp53.sl.home> wrote in message
>news:nKjIn.307794$KH2.262040(a)news.usenetserver.com...
>[...]
>
>> hint: man getaddrinfo, and pay special attention to the node argument.
>
> Oh no no not there man I know those parameters in my sleep. What do I do
>with the core dump use gdb? Aw let me see...
>
>Bill
>
>

You are passing NULL as the arg to client, which is then passed as the
'node' argument to getaddrinfo. Getaddrinfo will segfault if you pass
NULL as the node argument, which should be either the hostname or dotted-quad
IP address for the server.

scott
From: Bill Cunningham on

"Scott Lurndal" <scott(a)slp53.sl.home> wrote in message
news:rABIn.52890$y07.52111(a)news.usenetserver.com...

[snip]

> You are passing NULL as the arg to client, which is then passed as the
> 'node' argument to getaddrinfo. Getaddrinfo will segfault if you pass
> NULL as the node argument, which should be either the hostname or
> dotted-quad
> IP address for the server.

I believe you are right in some cases. Any concerning a client socket.
But I have passed NULL to parameter 1 of getaddrinfo() before and had no
problem but certain conditions must be met. I can't remember right off the
top of my head because I haven't done this in a while. As far as my client()
function goes I am passing to its first parameter a NULL yes. The second
paramter of the getaddrinfo function always must be a port number.

Bill