Hi Hideaki, (assume you can speak for JP linux group)...??
Forgot to add the code snippet in my response. Sorry about that.
Here it is now for this issue from one of our mail messsages when
parsing the parameters some time ago...
regards,
/jim
>>* struct addrinfo{}
>> Type of ai_addrlen member should be delcared as socklen_t,
>> not size_t.
>> (it can be used as 3rd argument for connect() or bind() directly;
>> otherwise, we must do a "cast" operation.
>
>Hmmm. Works fine for me??? But I do see your point. We are following
>XNET lead here see code snippet below and tell me why I will not work
>for you?
int
myconnect(char *hostname, char *servicename)
{
struct addrinfo *res, *aip;
struct addrinfo hints;
int sock = -1;
int error;
/* Get host address. Any type of address will do. */
bzero(&hints, sizeof (hints));
hints.ai_flags = AI_ALL|AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo(hostname, servicename, &hints, &aip);
if (error != 0) {
(void) fprintf(stderr,
"getaddrinfo: %s for host %s service %s\n",
gai_strerror(error), hostname, servicename);
return (-1);
}
/* Open socket. */
sock = socket(aip->ai_family, aip->ai_socktype,
aip->ai_protocol);
if (sock == -1) {
perror("socket");
freeaddrinfo(res);
return (-1);
}
/* Connect to the host. */
if (connect(sock, aip->ai_addr, aip->ai_addrlen) == -1) {
perror("connect");
(void) close(sock);
return (-1);
}
freeaddrinfo(res);
return (sock);
}
--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page: http://playground.sun.com/ipng
FTP archive: ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [EMAIL PROTECTED]
--------------------------------------------------------------------