xapian-core  1.4.27
socket_utils.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2006,2007,2008,2015 Olly Betts
5  * Copyright (C) 2008 Lemur Consulting Ltd
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef XAPIAN_INCLUDED_SOCKET_UTILS_H
23 #define XAPIAN_INCLUDED_SOCKET_UTILS_H
24 
25 #include "safeunistd.h"
26 
27 #ifdef __WIN32__
28 
29 #include "safewinsock2.h"
30 
32 extern HANDLE fd_to_handle(int fd);
33 
35 extern void close_fd_or_socket(int fd);
36 #else
37 // There's no distinction between sockets and other fds on UNIX.
38 inline void close_fd_or_socket(int fd) { close(fd); }
39 #endif
40 
49 void set_socket_timeouts(int fd, double timeout);
50 
51 #endif // XAPIAN_INCLUDED_SOCKET_UTILS_H
int close(FD &fd)
Definition: fd.h:63
void set_socket_timeouts(int fd, double timeout)
Attempt to set socket-level timeouts.
Definition: socket_utils.cc:64
unsigned timeout
A timeout value in milliseconds.
Definition: types.h:100
include <winsock2.h> but working around problems.
void close_fd_or_socket(int fd)
Definition: socket_utils.h:38
<unistd.h>, but with compat.