updated the default definition of moo_sa_family_t

This commit is contained in:
hyunghwan.chung 2018-01-19 13:29:15 +00:00
parent d3a57db467
commit 9a49b4fa53
4 changed files with 48 additions and 5 deletions

View File

@ -189,6 +189,48 @@ LIBS="$save_LIBS"
AC_SUBST(TERMINAL_LIBS) AC_SUBST(TERMINAL_LIBS)
dnl OLDLIBS="$LIBS"
dnl AC_SEARCH_LIBS([connect], [socket])
dnl LIBS="$OLDLIBS"
dnl if test "$ac_cv_search_connect" != "none required" -a "$ac_cv_search_connect" != "no"
dnl then
dnl SOCKET_LIBS="$SOCKET_LIBS -lsocket"
dnl fi
dnl AC_SUBST(SOCKET_LIBS)
AC_CHECK_FUNCS([connect gethostbyname])
if test "x$ac_cv_func_gethostbyname" = "xno"
then
AC_CHECK_LIB([nsl], [gethostbyname], [
SOCKET_LIBS="$SOCKET_LIBS -lnsl"
AC_DEFINE(HAVE_GETHOSTBYNAME, 1)
])
fi
if test "x$ac_cv_func_connect" = "xno"
then
AC_CHECK_LIB([socket], [connect], [
SOCKET_LIBS="$SOCKET_LIBS -lsocket"
AC_DEFINE(HAVE_CONNECT, 1)
])
if test "x$ac_cv_lib_socket_connect" = xno
then
AC_CHECK_FUNCS([t_connect])
if test "x$ac_cv_func_t_connect" = "xno"
then
AC_CHECK_LIB([nsl_s], [t_connect], [
SOCKET_LIBS="$SOCKET_LIBS -lnsl_s"
AC_DEFINE(HAVE_T_CONNECT, 1)
])
fi
fi
fi
if test "x${platform_win32}" = "xyes"
then
SOCKET_LIBS="$SOCKET_LIBS -lws2_32"
fi
AC_SUBST(SOCKET_LIBS)
dnl check is the import library for unicows.dll exists dnl check is the import library for unicows.dll exists
dnl this check doesn't look for a particular symbol dnl this check doesn't look for a particular symbol
dnl but for the symbol 'main' since i want to check dnl but for the symbol 'main' since i want to check

View File

@ -505,7 +505,7 @@ error -> exception
[ [
s := Socket domain: Socket.Domain.INET type: Socket.Type.STREAM. s := Socket domain: Socket.Domain.INET type: Socket.Type.STREAM.
s inputAction: inact; outputAction: outact. s inputAction: inact; outputAction: outact.
s connectTo: (SocketAddress fromString: '127.0.0.1:9999') do: conact. s connectTo: (SocketAddress fromString: '192.168.1.108:9999') do: conact.
s2 := Socket domain: Socket.Domain.INET type: Socket.Type.STREAM. s2 := Socket domain: Socket.Domain.INET type: Socket.Type.STREAM.
s2 inputAction: accact. s2 inputAction: accact.

View File

@ -103,9 +103,9 @@ struct sck_t
#endif #endif
#else #else
# undef MOO_SIZEOF_SA_FAMILY_T # undef MOO_SIZEOF_SA_FAMILY_T
# define MOO_SIZEOF_SA_FAMILY_T MOO_SIZEOF_INT # define MOO_SIZEOF_SA_FAMILY_T MOO_SIZEOF_SHORT
# define MOO_SA_FAMILY_T_IS_SIGNED # undef MOO_SA_FAMILY_T_IS_SIGNED
typedef int sck_addr_family_t; typedef unsigned short int sck_addr_family_t;
#endif #endif
struct sck_addr_t struct sck_addr_t

View File

@ -63,6 +63,7 @@ static moo_pfrc_t pf_open_socket (moo_t* moo, moo_ooi_t nargs)
typev |= SOCK_NONBLOCK | SOCK_CLOEXEC; typev |= SOCK_NONBLOCK | SOCK_CLOEXEC;
create_socket: create_socket:
#endif #endif
fd = socket (MOO_OOP_TO_SMOOI(dom), typev, MOO_OOP_TO_SMOOI(proto)); fd = socket (MOO_OOP_TO_SMOOI(dom), typev, MOO_OOP_TO_SMOOI(proto));
if (fd == -1) if (fd == -1)
{ {
@ -324,7 +325,7 @@ static moo_pfrc_t pf_connect (moo_t* moo, moo_ooi_t nargs)
n = connect(fd, (struct sockaddr*)MOO_OBJ_GET_BYTE_SLOT(arg), moo_sck_addr_len((sck_addr_t*)MOO_OBJ_GET_BYTE_SLOT(arg))); n = connect(fd, (struct sockaddr*)MOO_OBJ_GET_BYTE_SLOT(arg), moo_sck_addr_len((sck_addr_t*)MOO_OBJ_GET_BYTE_SLOT(arg)));
} }
while (n == -1 && errno == EINTR); while (n == -1 && errno == EINTR);
if (n == -1 && errno != EINPROGRESS) if (n == -1 && errno != EINPROGRESS)
{ {
moo_seterrwithsyserr (moo, errno); moo_seterrwithsyserr (moo, errno);