index 7d2f7eb7d68a287b955023dff112017575bf9f26..aec4f34c7d20d9a333a506ec0e083b7e7dac0916 100644 (file)
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.90 2000年05月20日 13:10:54 ishii Exp $
+ * $Id: pqcomm.c,v 1.91 2000年05月21日 21:19:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
return STATUS_ERROR;
}
- /* select TCP_NODELAY option if it's a TCP connection */
+ /* select NODELAY and KEEPALIVE options if it's a TCP connection */
if (port->laddr.sa.sa_family == AF_INET)
{
- struct protoent *pe;
int on = 1;
- pe = getprotobyname("TCP");
- if (pe == NULL)
- {
- perror("postmaster: StreamConnection: getprotobyname");
- return STATUS_ERROR;
- }
- if (setsockopt(port->sock, pe->p_proto, TCP_NODELAY,
+ if (setsockopt(port->sock, IPPROTO_TCP, TCP_NODELAY,
&on, sizeof(on)) < 0)
{
perror("postmaster: StreamConnection: setsockopt(TCP_NODELAY)");
index c400a7ebb1604c9aa9915975188fc5479fd33510..400bab2f7d5990a174c26a940c949cbf5861a9f0 100644 (file)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.126 2000年04月12日 17:17:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.127 2000年05月21日 21:19:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include <sys/socket.h>
#include <unistd.h>
#include <netdb.h>
+#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#endif
static int
connectNoDelay(PGconn *conn)
{
- struct protoent *pe;
int on = 1;
- pe = getprotobyname("TCP");
- if (pe == NULL)
- {
- printfPQExpBuffer(&conn->errorMessage,
- "connectNoDelay() -- "
- "getprotobyname failed: errno=%d\n%s\n",
- errno, strerror(errno));
- return 0;
- }
- if (setsockopt(conn->sock, pe->p_proto, TCP_NODELAY,
+ if (setsockopt(conn->sock, IPPROTO_TCP, TCP_NODELAY,
#ifdef WIN32
(char *)
#endif