Use src/lib/w32/w32sockets.c for client
Move client's w32_connect() to w32sockets.c. Replace w32_recv() and w32_send() by read() and write(). Replace w32_close() by w32_close_function. Replace call of WSAStartup() in w32_sysdep_init() by w32_socket_init(). Remove the identical copies of fd_is_socket(), w32_set_winsock_errno(), w32_socket().
This commit is contained in:
parent
1153d9c995
commit
4d40a27542
12 changed files with 49 additions and 200 deletions
|
@ -147,6 +147,25 @@ w32_bind(int fd, const struct sockaddr *name, socklen_t namelen)
|
|||
SOCKET_FUNCTION(bind(sock, name, namelen));
|
||||
}
|
||||
|
||||
/*
|
||||
* POSIX compatible connect() replacement
|
||||
*/
|
||||
#undef connect
|
||||
int
|
||||
w32_connect(int sockfd, const struct sockaddr *addr, int addrlen)
|
||||
{
|
||||
SOCKET sock = W32_FD_TO_SOCKET(sockfd);
|
||||
int result;
|
||||
|
||||
result = connect(sock, addr, addrlen);
|
||||
if (result == SOCKET_ERROR) {
|
||||
/* FIXME map WSAEWOULDBLOCK to EINPROGRESS */
|
||||
w32_set_winsock_errno();
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* POSIX equivalent for listen().
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue