libowfat/socket/socket_tcp6.c

22 lines
511 B
C
Raw Normal View History

#include <sys/types.h>
#ifndef __MINGW32__
2006-05-18 06:13:25 +00:00
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
#include <errno.h>
#include "haveip6.h"
2001-02-02 17:54:47 +00:00
#include "socket.h"
2006-05-18 06:13:25 +00:00
#include "ndelay.h"
2001-02-02 17:54:47 +00:00
int socket_tcp6(void) {
int s;
#if defined(LIBC_HAS_IP6) && defined(SOCK_NONBLOCK)
if ((s=socket(noipv6?PF_INET:PF_INET6,SOCK_STREAM|SOCK_NONBLOCK,IPPROTO_TCP))>-1 || errno!=EINVAL) return s;
#endif
s=socket_tcp6b();
if (s==-1) return -1;
if (ndelay_on(s) == -1) { close(s); return -1; }
return s;
2001-02-02 17:54:47 +00:00
}