The R Project SVN R

Rev

Rev 75220 | Rev 77822 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75220 Rev 76978
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 
3
 
4
 *  Copyright (C) 1998-2015   The R Core Team
4
 *  Copyright (C) 1998-2019   The R Core Team
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 54... Line 54...
54
 
54
 
55
#if defined(__hpux)
55
#if defined(__hpux)
56
   extern int h_errno; /* HP-UX 9.05 forgets to declare this in netdb.h */
56
   extern int h_errno; /* HP-UX 9.05 forgets to declare this in netdb.h */
57
#endif
57
#endif
58
 
58
 
-
 
59
extern struct hostent *R_gethostbyname(const char *name);
-
 
60
 
59
#define MAXBACKLOG 5
61
#define MAXBACKLOG 5
60
 
62
 
61
static int Sock_error(Sock_error_t perr, int e, int he)
63
static int Sock_error(Sock_error_t perr, int e, int he)
62
{
64
{
63
    if (perr != NULL) {
65
    if (perr != NULL) {
Line 193... Line 195...
193
    struct sockaddr_in server;
195
    struct sockaddr_in server;
194
    struct hostent *hp;
196
    struct hostent *hp;
195
    int sock;
197
    int sock;
196
    int retval;
198
    int retval;
197
 
199
 
198
    if (! (hp = gethostbyname(sname))
200
    if (! (hp = R_gethostbyname(sname))
199
	|| (sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
201
	|| (sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
200
	return Sock_error(perr, errno, h_errno);
202
	return Sock_error(perr, errno, h_errno);
201
 
203
 
202
    memcpy((char *)&server.sin_addr, hp->h_addr_list[0], hp->h_length);
204
    memcpy((char *)&server.sin_addr, hp->h_addr_list[0], hp->h_length);
203
    server.sin_port = htons((short)port);
205
    server.sin_port = htons((short)port);