added Socket::sendx() functions
added SocketAddress::set() that accepts a string fixed a bug in nwad-skad.c
This commit is contained in:
parent
3613919dc1
commit
9d87420bf6
346
qse/configure
vendored
346
qse/configure
vendored
@ -19404,12 +19404,13 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
for ac_func in accept4
|
||||
for ac_func in accept4 sendmsg recvmsg writev readv
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4"
|
||||
if test "x$ac_cv_func_accept4" = xyes; then :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_ACCEPT4 1
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
@ -22004,6 +22005,211 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of SOCK_STREAM" >&5
|
||||
$as_echo_n "checking numeric value of SOCK_STREAM... " >&6; }
|
||||
if ${ax_cv_numvalof_SOCK_STREAM+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(SOCK_STREAM)" "ax_cv_numvalof_SOCK_STREAM" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_SOCK_STREAM=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_SOCK_STREAM" >&5
|
||||
$as_echo "$ax_cv_numvalof_SOCK_STREAM" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_SOCK_STREAM $ax_cv_numvalof_SOCK_STREAM
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of SOCK_DGRAM" >&5
|
||||
$as_echo_n "checking numeric value of SOCK_DGRAM... " >&6; }
|
||||
if ${ax_cv_numvalof_SOCK_DGRAM+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(SOCK_DGRAM)" "ax_cv_numvalof_SOCK_DGRAM" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_SOCK_DGRAM=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_SOCK_DGRAM" >&5
|
||||
$as_echo "$ax_cv_numvalof_SOCK_DGRAM" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_SOCK_DGRAM $ax_cv_numvalof_SOCK_DGRAM
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of SOCK_RAW" >&5
|
||||
$as_echo_n "checking numeric value of SOCK_RAW... " >&6; }
|
||||
if ${ax_cv_numvalof_SOCK_RAW+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(SOCK_RAW)" "ax_cv_numvalof_SOCK_RAW" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_SOCK_RAW=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_SOCK_RAW" >&5
|
||||
$as_echo "$ax_cv_numvalof_SOCK_RAW" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_SOCK_RAW $ax_cv_numvalof_SOCK_RAW
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of AF_INET" >&5
|
||||
$as_echo_n "checking numeric value of AF_INET... " >&6; }
|
||||
if ${ax_cv_numvalof_AF_INET+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(AF_INET)" "ax_cv_numvalof_AF_INET" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_AF_INET=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_AF_INET" >&5
|
||||
$as_echo "$ax_cv_numvalof_AF_INET" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_AF_INET $ax_cv_numvalof_AF_INET
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of AF_INET6" >&5
|
||||
$as_echo_n "checking numeric value of AF_INET6... " >&6; }
|
||||
if ${ax_cv_numvalof_AF_INET6+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(AF_INET6)" "ax_cv_numvalof_AF_INET6" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_AF_INET6=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_AF_INET6" >&5
|
||||
$as_echo "$ax_cv_numvalof_AF_INET6" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_AF_INET6 $ax_cv_numvalof_AF_INET6
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of AF_PACKET" >&5
|
||||
$as_echo_n "checking numeric value of AF_PACKET... " >&6; }
|
||||
if ${ax_cv_numvalof_AF_PACKET+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(AF_PACKET)" "ax_cv_numvalof_AF_PACKET" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_AF_PACKET=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_AF_PACKET" >&5
|
||||
$as_echo "$ax_cv_numvalof_AF_PACKET" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_AF_PACKET $ax_cv_numvalof_AF_PACKET
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking numeric value of AF_UNIX" >&5
|
||||
$as_echo_n "checking numeric value of AF_UNIX... " >&6; }
|
||||
if ${ax_cv_numvalof_AF_UNIX+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(AF_UNIX)" "ax_cv_numvalof_AF_UNIX" "#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
ax_cv_numvalof_AF_UNIX=-1
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_numvalof_AF_UNIX" >&5
|
||||
$as_echo "$ax_cv_numvalof_AF_UNIX" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define NUMVALOF_AF_UNIX $ax_cv_numvalof_AF_UNIX
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
if test "x${platform_win32}" = "xyes"
|
||||
then
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
@ -22728,6 +22934,76 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
|
||||
# This bug is HP SR number 8606223364.
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of struct iovec" >&5
|
||||
$as_echo_n "checking size of struct iovec... " >&6; }
|
||||
if ${ac_cv_sizeof_struct_iovec+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct iovec))" "ac_cv_sizeof_struct_iovec" "#include <sys/uio.h>
|
||||
"; then :
|
||||
|
||||
else
|
||||
if test "$ac_cv_type_struct_iovec" = yes; then
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error 77 "cannot compute sizeof (struct iovec)
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
ac_cv_sizeof_struct_iovec=0
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_struct_iovec" >&5
|
||||
$as_echo "$ac_cv_sizeof_struct_iovec" >&6; }
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SIZEOF_STRUCT_IOVEC $ac_cv_sizeof_struct_iovec
|
||||
_ACEOF
|
||||
|
||||
|
||||
if test ${ac_cv_sizeof_struct_iovec} -gt 0
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking offset of iov_base in struct iovec" >&5
|
||||
$as_echo_n "checking offset of iov_base in struct iovec... " >&6; }
|
||||
if ac_fn_c_compute_int "$LINENO" "offsetof(struct iovec, iov_base)" "ac_cv_offsetof_iov_base" "#include <stddef.h>
|
||||
#include <sys/uio.h>"; then :
|
||||
|
||||
else
|
||||
ac_cv_offsteof_iov_base=0
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_offsetof_iov_base" >&5
|
||||
$as_echo "$ac_cv_offsetof_iov_base" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_OFFSETOF_IOV_BASE ${ac_cv_offsetof_iov_base}
|
||||
_ACEOF
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking offset of iov_len in struct iovec" >&5
|
||||
$as_echo_n "checking offset of iov_len in struct iovec... " >&6; }
|
||||
if ac_fn_c_compute_int "$LINENO" "offsetof(struct iovec, iov_len)" "ac_cv_offsetof_iov_len" "#include <stddef.h>
|
||||
#include <sys/uio.h>"; then :
|
||||
|
||||
else
|
||||
ac_cv_offsteof_iov_len=0
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_offsetof_iov_len" >&5
|
||||
$as_echo "$ac_cv_offsetof_iov_len" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_OFFSETOF_IOV_LEN ${ac_cv_offsetof_iov_len}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
# The cast to long int works around a bug in the HP C Compiler
|
||||
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
|
||||
@ -23272,6 +23548,63 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
if test ${ax_cv_numvalof_SOCK_STREAM} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_SOCK_STREAM ${ax_cv_numvalof_SOCK_STREAM}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
if test ${ax_cv_numvalof_SOCK_DGRAM} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_SOCK_DGRAM ${ax_cv_numvalof_SOCK_DGRAM}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
if test ${ax_cv_numvalof_SOCK_RAW} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_SOCK_RAW ${ax_cv_numvalof_SOCK_RAW}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_INET} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_AF_INET ${ax_cv_numvalof_AF_INET}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_INET6} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_AF_INET6 ${ax_cv_numvalof_AF_INET6}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_PACKET} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_AF_PACKET ${ax_cv_numvalof_AF_PACKET}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_UNIX} -ge 0
|
||||
then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_AF_UNIX ${ax_cv_numvalof_AF_UNIX}
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_SIZEOF_STRUCT_SOCKADDR_IN ${ac_cv_sizeof_struct_sockaddr_in}
|
||||
@ -23316,6 +23649,11 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_SIZEOF_STRUCT_IOVEC ${ac_cv_sizeof_struct_iovec}
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define QSE_SIZEOF_PTHREAD_T ${ac_cv_sizeof_pthread_t}
|
||||
_ACEOF
|
||||
|
@ -156,7 +156,7 @@ AC_CHECK_FUNCS([backtrace backtrace_symbols])
|
||||
AC_CHECK_FUNCS([fork vfork posix_spawn gettid nanosleep select])
|
||||
AC_CHECK_FUNCS([makecontext swapcontext getcontext setcontext])
|
||||
AC_CHECK_FUNCS([snprintf _vsnprintf _vsnwprintf])
|
||||
AC_CHECK_FUNCS([accept4])
|
||||
AC_CHECK_FUNCS([accept4 sendmsg recvmsg writev readv])
|
||||
|
||||
OLDLIBS="$LIBS"
|
||||
LIBS="$LIBM $LIBS"
|
||||
@ -422,6 +422,29 @@ AC_CHECK_SIZEOF(mbstate_t,,[#include <wchar.h>])
|
||||
AX_CHECK_NUMVALOF(MB_LEN_MAX,[32],[#include <limits.h>])
|
||||
AX_CHECK_NUMVALOF(PATH_MAX,[0],[#include <limits.h>])
|
||||
|
||||
AX_CHECK_NUMVALOF(SOCK_STREAM, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
AX_CHECK_NUMVALOF(SOCK_DGRAM, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
AX_CHECK_NUMVALOF(SOCK_RAW, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
|
||||
AX_CHECK_NUMVALOF(AF_INET, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
AX_CHECK_NUMVALOF(AF_INET6, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
AX_CHECK_NUMVALOF(AF_PACKET, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
AX_CHECK_NUMVALOF(AF_UNIX, [-1], [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>])
|
||||
|
||||
if test "x${platform_win32}" = "xyes"
|
||||
then
|
||||
AC_CHECK_SIZEOF(struct sockaddr_in,,[
|
||||
@ -530,13 +553,32 @@ else
|
||||
AC_DEFINE_UNQUOTED(QSE_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(struct iovec,,[#include <sys/uio.h>])
|
||||
if test ${ac_cv_sizeof_struct_iovec} -gt 0
|
||||
then
|
||||
AC_MSG_CHECKING([offset of iov_base in struct iovec])
|
||||
AC_COMPUTE_INT([ac_cv_offsetof_iov_base],
|
||||
[[offsetof(struct iovec, iov_base)]],
|
||||
[#include <stddef.h>
|
||||
#include <sys/uio.h>], [ac_cv_offsteof_iov_base=0])
|
||||
AC_MSG_RESULT([$ac_cv_offsetof_iov_base])
|
||||
AC_DEFINE_UNQUOTED(QSE_OFFSETOF_IOV_BASE, ${ac_cv_offsetof_iov_base}, [offsetof(struct iovec, iov_base)])
|
||||
|
||||
AC_MSG_CHECKING([offset of iov_len in struct iovec])
|
||||
AC_COMPUTE_INT([ac_cv_offsetof_iov_len],
|
||||
[[offsetof(struct iovec, iov_len)]],
|
||||
[#include <stddef.h>
|
||||
#include <sys/uio.h>], [ac_cv_offsteof_iov_len=0])
|
||||
AC_MSG_RESULT([$ac_cv_offsetof_iov_len])
|
||||
AC_DEFINE_UNQUOTED(QSE_OFFSETOF_IOV_LEN, ${ac_cv_offsetof_iov_len}, [offsetof(struct iovec, iov_len)])
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(pthread_t,, [#include <pthread.h>])
|
||||
if test ${ac_cv_sizeof_pthread_t} -gt 0
|
||||
then
|
||||
AX_CHECK_SIGN([pthread_t],
|
||||
[ AC_DEFINE(QSE_PTHREAD_T_IS_SIGNED, 1, [Define if pthread_t is signed]) ],
|
||||
[ AS_ECHO_N("") ],
|
||||
[AC_DEFINE(QSE_PTHREAD_T_IS_SIGNED, 1, [Define if pthread_t is signed])],
|
||||
[AS_ECHO_N("")],
|
||||
[#include <pthread.h>])
|
||||
fi
|
||||
|
||||
@ -688,6 +730,35 @@ then
|
||||
AC_DEFINE_UNQUOTED(QSE_PATH_MAX, ${ax_cv_numvalof_PATH_MAX}, [PATH_MAX])
|
||||
fi
|
||||
|
||||
if test ${ax_cv_numvalof_SOCK_STREAM} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_SOCK_STREAM, ${ax_cv_numvalof_SOCK_STREAM}, [SOCK_STREAM])
|
||||
fi
|
||||
if test ${ax_cv_numvalof_SOCK_DGRAM} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_SOCK_DGRAM, ${ax_cv_numvalof_SOCK_DGRAM}, [SOCK_DGRAM])
|
||||
fi
|
||||
if test ${ax_cv_numvalof_SOCK_RAW} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_SOCK_RAW, ${ax_cv_numvalof_SOCK_RAW}, [SOCK_RAW])
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_INET} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_AF_INET, ${ax_cv_numvalof_AF_INET}, [AF_INET])
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_INET6} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_AF_INET6, ${ax_cv_numvalof_AF_INET6}, [AF_INET6])
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_PACKET} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_AF_PACKET, ${ax_cv_numvalof_AF_PACKET}, [AF_PACKET])
|
||||
fi
|
||||
if test ${ax_cv_numvalof_AF_UNIX} -ge 0
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(QSE_AF_UNIX, ${ax_cv_numvalof_AF_UNIX}, [AF_UNIX])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_STRUCT_SOCKADDR_IN, ${ac_cv_sizeof_struct_sockaddr_in}, [sizeof(struct sockaddr_in)])
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_STRUCT_SOCKADDR_IN6, ${ac_cv_sizeof_struct_sockaddr_in6}, [sizeof(struct sockaddr_in6)])
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_STRUCT_SOCKADDR_UN, ${ac_cv_sizeof_struct_sockaddr_un}, [sizeof(struct sockaddr_un)])
|
||||
@ -699,6 +770,7 @@ AC_DEFINE_UNQUOTED(QSE_SIZEOF_SOCKLEN_T, ${ac_cv_sizeof_socklen_t}, [sizeof(sock
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_SA_FAMILY_T, ${ac_cv_sizeof_sa_family_t}, [sizeof(sa_family_t)])
|
||||
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_SOCKLEN_T, ${ac_cv_sizeof_socklen_t}, [sizeof(socklen_t)])
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_STRUCT_IOVEC, ${ac_cv_sizeof_struct_iovec}, [sizeof(struct iovec)])
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_PTHREAD_T, ${ac_cv_sizeof_pthread_t}, [sizeof(pthread_t)])
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_PTHREAD_MUTEX_T, ${ac_cv_sizeof_pthread_mutex_t}, [sizeof(pthread_mutex_t)])
|
||||
AC_DEFINE_UNQUOTED(QSE_SIZEOF_PTHREAD_COND_T, ${ac_cv_sizeof_pthread_cond_t}, [sizeof(pthread_cond_t)])
|
||||
|
@ -503,6 +503,12 @@
|
||||
/* Define to 1 if you have the `readdir64' function. */
|
||||
#undef HAVE_READDIR64
|
||||
|
||||
/* Define to 1 if you have the `readv' function. */
|
||||
#undef HAVE_READV
|
||||
|
||||
/* Define to 1 if you have the `recvmsg' function. */
|
||||
#undef HAVE_RECVMSG
|
||||
|
||||
/* Define to 1 if you have the `round' function. */
|
||||
#undef HAVE_ROUND
|
||||
|
||||
@ -530,6 +536,9 @@
|
||||
/* Define to 1 if you have the `sendfilev64' function. */
|
||||
#undef HAVE_SENDFILEV64
|
||||
|
||||
/* Define to 1 if you have the `sendmsg' function. */
|
||||
#undef HAVE_SENDMSG
|
||||
|
||||
/* Define to 1 if you have the `setcontext' function. */
|
||||
#undef HAVE_SETCONTEXT
|
||||
|
||||
@ -832,6 +841,9 @@
|
||||
/* This value is set to 1 to indicate that the system argz facility works */
|
||||
#undef HAVE_WORKING_ARGZ
|
||||
|
||||
/* Define to 1 if you have the `writev' function. */
|
||||
#undef HAVE_WRITEV
|
||||
|
||||
/* Define to 1 if you have the `_vsnprintf' function. */
|
||||
#undef HAVE__VSNPRINTF
|
||||
|
||||
@ -872,12 +884,33 @@
|
||||
/* Define if dlsym() requires a leading underscore in symbol names. */
|
||||
#undef NEED_USCORE
|
||||
|
||||
/* The size of `AF_INET', as computed by valueof. */
|
||||
#undef NUMVALOF_AF_INET
|
||||
|
||||
/* The size of `AF_INET6', as computed by valueof. */
|
||||
#undef NUMVALOF_AF_INET6
|
||||
|
||||
/* The size of `AF_PACKET', as computed by valueof. */
|
||||
#undef NUMVALOF_AF_PACKET
|
||||
|
||||
/* The size of `AF_UNIX', as computed by valueof. */
|
||||
#undef NUMVALOF_AF_UNIX
|
||||
|
||||
/* The size of `MB_LEN_MAX', as computed by valueof. */
|
||||
#undef NUMVALOF_MB_LEN_MAX
|
||||
|
||||
/* The size of `PATH_MAX', as computed by valueof. */
|
||||
#undef NUMVALOF_PATH_MAX
|
||||
|
||||
/* The size of `SOCK_DGRAM', as computed by valueof. */
|
||||
#undef NUMVALOF_SOCK_DGRAM
|
||||
|
||||
/* The size of `SOCK_RAW', as computed by valueof. */
|
||||
#undef NUMVALOF_SOCK_RAW
|
||||
|
||||
/* The size of `SOCK_STREAM', as computed by valueof. */
|
||||
#undef NUMVALOF_SOCK_STREAM
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
@ -903,6 +936,18 @@
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* AF_INET */
|
||||
#undef QSE_AF_INET
|
||||
|
||||
/* AF_INET6 */
|
||||
#undef QSE_AF_INET6
|
||||
|
||||
/* AF_PACKET */
|
||||
#undef QSE_AF_PACKET
|
||||
|
||||
/* AF_UNIX */
|
||||
#undef QSE_AF_UNIX
|
||||
|
||||
/* The default character type is the multi-byte character type */
|
||||
#undef QSE_CHAR_IS_MCHAR
|
||||
|
||||
@ -936,6 +981,12 @@
|
||||
/* Define if mode_t is signed */
|
||||
#undef QSE_MODE_T_IS_SIGNED
|
||||
|
||||
/* offsetof(struct iovec, iov_base) */
|
||||
#undef QSE_OFFSETOF_IOV_BASE
|
||||
|
||||
/* offsetof(struct iovec, iov_len) */
|
||||
#undef QSE_OFFSETOF_IOV_LEN
|
||||
|
||||
/* offsetof(struct sockaddr, sa_family) */
|
||||
#undef QSE_OFFSETOF_SA_FAMILY
|
||||
|
||||
@ -1023,6 +1074,9 @@
|
||||
/* sizeof(socklen_t) */
|
||||
#undef QSE_SIZEOF_SOCKLEN_T
|
||||
|
||||
/* sizeof(struct iovec) */
|
||||
#undef QSE_SIZEOF_STRUCT_IOVEC
|
||||
|
||||
/* sizeof(struct sockaddr_dl) */
|
||||
#undef QSE_SIZEOF_STRUCT_SOCKADDR_DL
|
||||
|
||||
@ -1068,6 +1122,15 @@
|
||||
/* Define if socklen_t is signed */
|
||||
#undef QSE_SOCKLEN_T_IS_SIGNED
|
||||
|
||||
/* SOCK_DGRAM */
|
||||
#undef QSE_SOCK_DGRAM
|
||||
|
||||
/* SOCK_RAW */
|
||||
#undef QSE_SOCK_RAW
|
||||
|
||||
/* SOCK_STREAM */
|
||||
#undef QSE_SOCK_STREAM
|
||||
|
||||
/* use qse_fltmax_t for floating-point numbers in AWK */
|
||||
#undef QSE_USE_AWK_FLTMAX
|
||||
|
||||
@ -1131,6 +1194,9 @@
|
||||
/* The size of `socklen_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SOCKLEN_T
|
||||
|
||||
/* The size of `struct iovec', as computed by sizeof. */
|
||||
#undef SIZEOF_STRUCT_IOVEC
|
||||
|
||||
/* The size of `struct sockaddr_dl', as computed by sizeof. */
|
||||
#undef SIZEOF_STRUCT_SOCKADDR_DL
|
||||
|
||||
|
@ -76,15 +76,22 @@ public:
|
||||
int open (int domain, int type, int protocol, int traits = 0) QSE_CPP_NOEXCEPT;
|
||||
void close () QSE_CPP_NOEXCEPT;
|
||||
|
||||
|
||||
int connect (const SocketAddress& target) QSE_CPP_NOEXCEPT;
|
||||
int bind (const SocketAddress& target) QSE_CPP_NOEXCEPT;
|
||||
int listen (int backlog) QSE_CPP_NOEXCEPT;
|
||||
int accept (Socket* newsck, SocketAddress* newaddr, int traits = 0) QSE_CPP_NOEXCEPT;
|
||||
|
||||
// The send() functions sends data by attemping a single call to the
|
||||
// underlying system calls
|
||||
qse_ssize_t send (const void* buf, qse_size_t len) QSE_CPP_NOEXCEPT;
|
||||
qse_ssize_t send (const void* buf, qse_size_t len, const SocketAddress& dstaddr) QSE_CPP_NOEXCEPT;
|
||||
|
||||
// The sendx() functions sends data as much as it can, possibly with multiple
|
||||
// underlying system calls.
|
||||
int sendx (const void* buf, qse_size_t len, qse_size_t* total_sent = QSE_NULL) QSE_CPP_NOEXCEPT;
|
||||
int sendx (const void* buf, qse_size_t len, const SocketAddress& dstaddr, qse_size_t* total_sent = QSE_NULL) QSE_CPP_NOEXCEPT;
|
||||
int sendx (qse_ioptl_t* vec, int count, qse_size_t* total_sent = QSE_NULL) QSE_CPP_NOEXCEPT;
|
||||
|
||||
qse_ssize_t receive (void* buf, qse_size_t len) QSE_CPP_NOEXCEPT;
|
||||
qse_ssize_t receive (void* buf, qse_size_t len, SocketAddress& srcaddr) QSE_CPP_NOEXCEPT;
|
||||
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
int set (const qse_skad_t* skad);
|
||||
int set (const qse_nwad_t* nwad);
|
||||
int set (const qse_mchar_t* str);
|
||||
int set (const qse_wchar_t* str);
|
||||
|
||||
protected:
|
||||
qse_skad_t skad;
|
||||
|
@ -762,6 +762,29 @@ struct qse_xptl_t
|
||||
};
|
||||
typedef struct qse_xptl_t qse_xptl_t;
|
||||
|
||||
/**
|
||||
* The qse_ioptl_t type defines an analogus type to 'struct iovec' typically
|
||||
* found on posix platforms
|
||||
*/
|
||||
#if (QSE_SIZEOF_STRUCT_IOVEC > 0) && (QSE_OFFSETOF_IOV_BASE != QSE_OFFSETOF_IOV_LEN)
|
||||
struct qse_ioptl_t
|
||||
{
|
||||
/* [THINK] do i have to go extreme to inject fillers by looking at the total size and the offsets ?
|
||||
* i believe most systems should define only two members - iovec_base and iovec_len */
|
||||
#if (QSE_OFFSETOF_IOV_BASE < QSE_OFFSETOF_IOV_LEN)
|
||||
void* ptr;
|
||||
qse_size_t len;
|
||||
#else
|
||||
qse_size_t len;
|
||||
void* ptr;
|
||||
#endif
|
||||
};
|
||||
typedef struct qse_ioptl_t qse_ioptl_t;
|
||||
#else
|
||||
typedef qse_xptl_t qse_ioptl_t;
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* The qse_floc_t type defines a structure that can hold a position
|
||||
* in a file.
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <qse/si/Socket.hpp>
|
||||
#include <qse/cmn/str.h>
|
||||
#include "../cmn/mem-prv.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -258,6 +259,151 @@ qse_ssize_t Socket::send (const void* buf, qse_size_t len, const SocketAddress&
|
||||
return n;
|
||||
}
|
||||
|
||||
int Socket::sendx (const void* buf, qse_size_t len, qse_size_t* total_sent) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (this->handle != QSE_INVALID_SCKHND);
|
||||
|
||||
qse_size_t pos = 0;
|
||||
|
||||
while (pos < len)
|
||||
{
|
||||
qse_ssize_t n = ::send(this->handle, (char*)buf + pos, len - pos, 0);
|
||||
if (n <= -1)
|
||||
{
|
||||
this->setErrorCode (syserr_to_errnum(errno));
|
||||
if (total_sent) *total_sent = pos;
|
||||
return -1;
|
||||
}
|
||||
|
||||
pos += n;
|
||||
}
|
||||
|
||||
if (total_sent) *total_sent = pos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Socket::sendx (const void* buf, qse_size_t len, const SocketAddress& dstaddr, qse_size_t* total_sent) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (this->handle != QSE_INVALID_SCKHND);
|
||||
|
||||
qse_size_t pos = 0;
|
||||
|
||||
while (pos < len)
|
||||
{
|
||||
qse_ssize_t n = ::sendto(this->handle, (char*)buf + pos, len - pos, 0, (struct sockaddr*)dstaddr.getAddrPtr(), dstaddr.getAddrSize());
|
||||
if (n == -1)
|
||||
{
|
||||
this->setErrorCode (syserr_to_errnum(errno));
|
||||
if (total_sent) *total_sent = pos;
|
||||
return -1;
|
||||
}
|
||||
|
||||
pos += n;
|
||||
}
|
||||
|
||||
if (total_sent) *total_sent = pos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Socket::sendx (qse_ioptl_t* iov, int count, qse_size_t* total_sent) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (this->handle != QSE_INVALID_SCKHND);
|
||||
|
||||
#if defined(HAVE_SENDMSG) || defined(HAVE_WRITEV)
|
||||
int index = 0;
|
||||
qse_size_t total = 0;
|
||||
int backup_index = -1;
|
||||
qse_ioptl_t backup;
|
||||
|
||||
#if defined(HAVE_SENDMSG)
|
||||
struct msghdr msg;
|
||||
QSE_MEMSET (&msg, 0, QSE_SIZEOF(msg));
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
ssize_t nwritten;
|
||||
|
||||
#if defined(HAVE_SENDMSG)
|
||||
msg.msg_iov = (struct iovec*)&iov[index];
|
||||
msg.msg_iovlen = count - index;
|
||||
nwritten = ::sendmsg(this->handle, &msg, 0);
|
||||
#else
|
||||
nwritten = ::writev(this->handle, (const struct iovec*)&iov[index], count - index);
|
||||
#endif
|
||||
if (nwritten <= -1)
|
||||
{
|
||||
this->setErrorCode (syserr_to_errnum(errno));
|
||||
if (backup_index >= 0) iov[backup_index] = backup;
|
||||
if (total_sent) *total_sent = total;
|
||||
return -1;
|
||||
}
|
||||
|
||||
total += nwritten;
|
||||
|
||||
while (index < count && (qse_size_t)nwritten >= iov[index].len)
|
||||
nwritten -= iov[index++].len;
|
||||
|
||||
if (index == count) break;
|
||||
|
||||
if (backup_index != index)
|
||||
{
|
||||
if (backup_index >= 0) iov[backup_index] = backup;
|
||||
backup = iov[index];
|
||||
backup_index = index;
|
||||
}
|
||||
|
||||
iov[index].ptr = (void*)((qse_uint8_t*)iov[index].ptr + nwritten);
|
||||
iov[index].len -= nwritten;
|
||||
}
|
||||
|
||||
if (backup_index >= 0) iov[backup_index] = backup;
|
||||
if (total_sent) *total_sent = total;
|
||||
return 0;
|
||||
|
||||
#else
|
||||
qse_ioptl_t* v, * ve;
|
||||
qse_size_t total = 0, pos, rem;
|
||||
ssize_t nwritten;
|
||||
|
||||
v = iov;
|
||||
ve = v + count;
|
||||
|
||||
while (v < ve)
|
||||
{
|
||||
if (v->len <= 0)
|
||||
{
|
||||
v++;
|
||||
continue;
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
rem = v->len;
|
||||
write_again:
|
||||
nwritten = ::send(this->handle, (qse_uint8_t*)v->ptr + pos, rem, 0);
|
||||
if (nwritten <= -1)
|
||||
{
|
||||
this->setErrorCode (syserr_to_errnum(errno));
|
||||
if (total_sent) *total_sent = total;
|
||||
return -1;
|
||||
}
|
||||
|
||||
total += nwritten;
|
||||
if ((qse_size_t)nwritten < rem)
|
||||
{
|
||||
pos += nwritten;
|
||||
rem -= nwritten;
|
||||
goto write_again;
|
||||
}
|
||||
|
||||
v++;
|
||||
}
|
||||
|
||||
if (total_sent) *total_sent = total;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
qse_ssize_t Socket::receive (void* buf, qse_size_t len) QSE_CPP_NOEXCEPT
|
||||
{
|
||||
QSE_ASSERT (this->handle != QSE_INVALID_SCKHND);
|
||||
|
@ -195,10 +195,24 @@ int SocketAddress::set (const qse_skad_t* skad)
|
||||
|
||||
int SocketAddress::set (const qse_nwad_t* nwad)
|
||||
{
|
||||
return qse_nwadtoskad (nwad, &this->skad);
|
||||
return qse_nwadtoskad(nwad, &this->skad);
|
||||
}
|
||||
|
||||
|
||||
int SocketAddress::set (const qse_mchar_t* str)
|
||||
{
|
||||
qse_nwad_t nwad;
|
||||
if (qse_mbstonwad(str, &nwad) <= -1) return -1;
|
||||
return qse_nwadtoskad(&nwad, &this->skad);
|
||||
}
|
||||
|
||||
int SocketAddress::set (const qse_wchar_t* str)
|
||||
{
|
||||
qse_nwad_t nwad;
|
||||
if (qse_wcstonwad(str, &nwad) <= -1) return -1;
|
||||
return qse_nwadtoskad(&nwad, &this->skad);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
QSE_END_NAMESPACE(QSE)
|
||||
/////////////////////////////////
|
||||
|
@ -270,29 +270,29 @@ int qse_skadsize (const qse_skad_t* skad)
|
||||
{
|
||||
switch (FAMILY(skad))
|
||||
{
|
||||
#if defined(AF_INET)
|
||||
#if defined(AF_INET)
|
||||
case AF_INET:
|
||||
{
|
||||
struct sockaddr_in in;
|
||||
return QSE_SIZEOF(in);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(AF_INET6)
|
||||
#if defined(AF_INET6)
|
||||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in in6;
|
||||
struct sockaddr_in6 in6;
|
||||
return QSE_SIZEOF(in6);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(AF_UNIX)
|
||||
#if defined(AF_UNIX)
|
||||
case AF_UNIX:
|
||||
{
|
||||
struct sockaddr_un un;
|
||||
return QSE_SIZEOF(un);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -20,6 +20,7 @@ bin_PROGRAMS = \
|
||||
nwif02 \
|
||||
pio01 \
|
||||
rwl01 \
|
||||
sck01 \
|
||||
sio01 \
|
||||
sio02 \
|
||||
sio03 \
|
||||
@ -64,11 +65,13 @@ if ENABLE_CXX
|
||||
|
||||
CXXLIB = -lqsesixx -lqsecmnxx
|
||||
|
||||
bin_PROGRAMS += thr02 spl02
|
||||
bin_PROGRAMS += sck01 spl02 thr02
|
||||
|
||||
sck01_SOURCES = sck01.cpp
|
||||
spl02_SOURCES = spl02.cpp
|
||||
thr02_SOURCES = thr02.cpp
|
||||
|
||||
sck01_LDADD = $(CXXLIB) $(LDADD)
|
||||
spl02_LDADD = $(CXXLIB) $(LDADD)
|
||||
thr02_LDADD = $(CXXLIB) $(LDADD)
|
||||
|
||||
|
@ -91,11 +91,11 @@ host_triplet = @host@
|
||||
bin_PROGRAMS = aio01$(EXEEXT) dir01$(EXEEXT) fio01$(EXEEXT) \
|
||||
fio02$(EXEEXT) fs01$(EXEEXT) fs02$(EXEEXT) fs03$(EXEEXT) \
|
||||
glob01$(EXEEXT) log01$(EXEEXT) nwad01$(EXEEXT) nwif01$(EXEEXT) \
|
||||
nwif02$(EXEEXT) pio01$(EXEEXT) rwl01$(EXEEXT) sio01$(EXEEXT) \
|
||||
sio02$(EXEEXT) sio03$(EXEEXT) spl01$(EXEEXT) task01$(EXEEXT) \
|
||||
thr01$(EXEEXT) $(am__EXEEXT_1)
|
||||
nwif02$(EXEEXT) pio01$(EXEEXT) rwl01$(EXEEXT) sck01$(EXEEXT) \
|
||||
sio01$(EXEEXT) sio02$(EXEEXT) sio03$(EXEEXT) spl01$(EXEEXT) \
|
||||
task01$(EXEEXT) thr01$(EXEEXT) $(am__EXEEXT_1)
|
||||
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
||||
@ENABLE_CXX_TRUE@am__append_2 = thr02 spl02
|
||||
@ENABLE_CXX_TRUE@am__append_2 = sck01 spl02 thr02
|
||||
subdir = samples/si
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
|
||||
@ -113,7 +113,8 @@ mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
@ENABLE_CXX_TRUE@am__EXEEXT_1 = thr02$(EXEEXT) spl02$(EXEEXT)
|
||||
@ENABLE_CXX_TRUE@am__EXEEXT_1 = sck01$(EXEEXT) spl02$(EXEEXT) \
|
||||
@ENABLE_CXX_TRUE@ thr02$(EXEEXT)
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_aio01_OBJECTS = aio01.$(OBJEXT)
|
||||
@ -178,6 +179,12 @@ am_rwl01_OBJECTS = rwl01.$(OBJEXT)
|
||||
rwl01_OBJECTS = $(am_rwl01_OBJECTS)
|
||||
rwl01_LDADD = $(LDADD)
|
||||
rwl01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||
am__sck01_SOURCES_DIST = sck01.cpp
|
||||
@ENABLE_CXX_TRUE@am_sck01_OBJECTS = sck01.$(OBJEXT)
|
||||
sck01_OBJECTS = $(am_sck01_OBJECTS)
|
||||
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||
@ENABLE_CXX_TRUE@sck01_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
@ENABLE_CXX_TRUE@ $(am__DEPENDENCIES_3)
|
||||
am_sio01_OBJECTS = sio01.$(OBJEXT)
|
||||
sio01_OBJECTS = $(am_sio01_OBJECTS)
|
||||
sio01_LDADD = $(LDADD)
|
||||
@ -197,7 +204,6 @@ spl01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||
am__spl02_SOURCES_DIST = spl02.cpp
|
||||
@ENABLE_CXX_TRUE@am_spl02_OBJECTS = spl02.$(OBJEXT)
|
||||
spl02_OBJECTS = $(am_spl02_OBJECTS)
|
||||
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||
@ENABLE_CXX_TRUE@spl02_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
@ENABLE_CXX_TRUE@ $(am__DEPENDENCIES_3)
|
||||
am_task01_OBJECTS = task01.$(OBJEXT)
|
||||
@ -269,18 +275,18 @@ SOURCES = $(aio01_SOURCES) $(dir01_SOURCES) $(fio01_SOURCES) \
|
||||
$(fio02_SOURCES) $(fs01_SOURCES) $(fs02_SOURCES) \
|
||||
$(fs03_SOURCES) $(glob01_SOURCES) $(log01_SOURCES) \
|
||||
$(nwad01_SOURCES) $(nwif01_SOURCES) $(nwif02_SOURCES) \
|
||||
$(pio01_SOURCES) $(rwl01_SOURCES) $(sio01_SOURCES) \
|
||||
$(sio02_SOURCES) $(sio03_SOURCES) $(spl01_SOURCES) \
|
||||
$(spl02_SOURCES) $(task01_SOURCES) $(thr01_SOURCES) \
|
||||
$(thr02_SOURCES)
|
||||
$(pio01_SOURCES) $(rwl01_SOURCES) $(sck01_SOURCES) \
|
||||
$(sio01_SOURCES) $(sio02_SOURCES) $(sio03_SOURCES) \
|
||||
$(spl01_SOURCES) $(spl02_SOURCES) $(task01_SOURCES) \
|
||||
$(thr01_SOURCES) $(thr02_SOURCES)
|
||||
DIST_SOURCES = $(aio01_SOURCES) $(dir01_SOURCES) $(fio01_SOURCES) \
|
||||
$(fio02_SOURCES) $(fs01_SOURCES) $(fs02_SOURCES) \
|
||||
$(fs03_SOURCES) $(glob01_SOURCES) $(log01_SOURCES) \
|
||||
$(nwad01_SOURCES) $(nwif01_SOURCES) $(nwif02_SOURCES) \
|
||||
$(pio01_SOURCES) $(rwl01_SOURCES) $(sio01_SOURCES) \
|
||||
$(sio02_SOURCES) $(sio03_SOURCES) $(spl01_SOURCES) \
|
||||
$(am__spl02_SOURCES_DIST) $(task01_SOURCES) $(thr01_SOURCES) \
|
||||
$(am__thr02_SOURCES_DIST)
|
||||
$(pio01_SOURCES) $(rwl01_SOURCES) $(am__sck01_SOURCES_DIST) \
|
||||
$(sio01_SOURCES) $(sio02_SOURCES) $(sio03_SOURCES) \
|
||||
$(spl01_SOURCES) $(am__spl02_SOURCES_DIST) $(task01_SOURCES) \
|
||||
$(thr01_SOURCES) $(am__thr02_SOURCES_DIST)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@ -517,8 +523,10 @@ spl01_SOURCES = spl01.c
|
||||
task01_SOURCES = task01.c
|
||||
thr01_SOURCES = thr01.c
|
||||
@ENABLE_CXX_TRUE@CXXLIB = -lqsesixx -lqsecmnxx
|
||||
@ENABLE_CXX_TRUE@sck01_SOURCES = sck01.cpp
|
||||
@ENABLE_CXX_TRUE@spl02_SOURCES = spl02.cpp
|
||||
@ENABLE_CXX_TRUE@thr02_SOURCES = thr02.cpp
|
||||
@ENABLE_CXX_TRUE@sck01_LDADD = $(CXXLIB) $(LDADD)
|
||||
@ENABLE_CXX_TRUE@spl02_LDADD = $(CXXLIB) $(LDADD)
|
||||
@ENABLE_CXX_TRUE@thr02_LDADD = $(CXXLIB) $(LDADD)
|
||||
all: all-am
|
||||
@ -660,6 +668,10 @@ rwl01$(EXEEXT): $(rwl01_OBJECTS) $(rwl01_DEPENDENCIES) $(EXTRA_rwl01_DEPENDENCIE
|
||||
@rm -f rwl01$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(rwl01_OBJECTS) $(rwl01_LDADD) $(LIBS)
|
||||
|
||||
sck01$(EXEEXT): $(sck01_OBJECTS) $(sck01_DEPENDENCIES) $(EXTRA_sck01_DEPENDENCIES)
|
||||
@rm -f sck01$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(sck01_OBJECTS) $(sck01_LDADD) $(LIBS)
|
||||
|
||||
sio01$(EXEEXT): $(sio01_OBJECTS) $(sio01_DEPENDENCIES) $(EXTRA_sio01_DEPENDENCIES)
|
||||
@rm -f sio01$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(sio01_OBJECTS) $(sio01_LDADD) $(LIBS)
|
||||
@ -712,6 +724,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nwif02.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio01.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rwl01.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sck01.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio01.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio02.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio03.Po@am__quote@
|
||||
|
67
qse/samples/si/sck01.cpp
Normal file
67
qse/samples/si/sck01.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include <qse/si/Socket.hpp>
|
||||
#include <qse/si/mtx.h>
|
||||
#include <qse/si/sio.h>
|
||||
#include <qse/cmn/mem.h>
|
||||
|
||||
#include <locale.h>
|
||||
#if defined(_WIN32)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
static int test1 ()
|
||||
{
|
||||
QSE::Socket s;
|
||||
QSE::SocketAddress addr;
|
||||
qse_ioptl_t k[3];
|
||||
|
||||
if (s.open (QSE_AF_INET6, QSE_SOCK_STREAM, 0) <= -1)
|
||||
{
|
||||
qse_printf (QSE_T("cannot open socket\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
addr.set ("[::1]:9999");
|
||||
s.connect (addr);
|
||||
|
||||
k[0].ptr = (void*)"hello";
|
||||
k[0].len = 5;
|
||||
k[1].ptr = (void*)"world";
|
||||
k[1].len = 5;
|
||||
k[2].ptr = (void*)"forever";
|
||||
k[2].len = 7;
|
||||
s.sendx (k, 3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
char locale[100];
|
||||
UINT codepage = GetConsoleOutputCP();
|
||||
if (codepage == CP_UTF8)
|
||||
{
|
||||
/*SetConsoleOUtputCP (CP_UTF8);*/
|
||||
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf (locale, ".%u", (unsigned int)codepage);
|
||||
setlocale (LC_ALL, locale);
|
||||
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
|
||||
}
|
||||
#else
|
||||
setlocale (LC_ALL, "");
|
||||
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
|
||||
#endif
|
||||
|
||||
qse_open_stdsios ();
|
||||
test1();
|
||||
qse_close_stdsios ();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user