git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24642
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
* Name: gsocket.c
* Authors: Guilhem Lavaux,
* Guillermo Rodriguez Garcia <guille@iies.es> (maintainer)
* Name: gsocket.c
* Authors: Guilhem Lavaux,
* Guillermo Rodriguez Garcia <guille@iies.es> (maintainer)
- * Purpose: GSocket main Unix file
+ * Purpose: GSocket main Unix and OS/2 file
* Licence: The wxWindows licence
* CVSID: $Id$
* -------------------------------------------------------------------------
* Licence: The wxWindows licence
* CVSID: $Id$
* -------------------------------------------------------------------------
#include "wx/setup.h"
#endif
#include "wx/setup.h"
#endif
+#if defined(__VISAGECPP__)
+/* Seems to be needed by Visual Age C++, though I don't see how it manages
+ to not break on including a C++ header into a plain C source file */
+#include "wx/defs.h"
+#define BSD_SELECT /* use Berkley Sockets select */
+#endif
+
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
#include <assert.h>
#include <sys/types.h>
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
#include <assert.h>
#include <sys/types.h>
+#ifdef __VISAGECPP__
+#include <string.h>
+#include <sys/time.h>
+#include <types.h>
+#include <netinet/in.h>
+#endif
#include <netdb.h>
#include <sys/ioctl.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <sys/un.h>
#endif
#include <sys/un.h>
#endif
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#else
+#include <nerrno.h>
+# if __IBMCPP__ < 400
+#include <machine/endian.h>
+#include <socket.h>
+#include <ioctl.h>
+#include <select.h>
+#include <unistd.h>
+
+#define EBADF SOCEBADF
+
+# ifdef min
+# undef min
+# endif
+# else
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+
+#define close(a) soclose(a)
+#define select(a,b,c,d,e) bsdselect(a,b,c,d,e)
+int _System bsdselect(int,
+ struct fd_set *,
+ struct fd_set *,
+ struct fd_set *,
+ struct timeval *);
+int _System soclose(int);
+# endif
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
sck->m_error = GSOCK_IOERR;
return GSOCK_IOERR;
}
sck->m_error = GSOCK_IOERR;
return GSOCK_IOERR;
}
+#if defined(__EMX__) || defined(__VISAGECPP__)
+ ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
+#else
ioctl(sck->m_fd, FIONBIO, &arg);
ioctl(sck->m_fd, FIONBIO, &arg);
_GSocket_Enable_Events(sck);
/* Bind to the local address,
_GSocket_Enable_Events(sck);
/* Bind to the local address,
socket->m_error = err;
return NULL;
}
socket->m_error = err;
return NULL;
}
+#if defined(__EMX__) || defined(__VISAGECPP__)
+ ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
+#else
ioctl(connection->m_fd, FIONBIO, &arg);
ioctl(connection->m_fd, FIONBIO, &arg);
_GSocket_Enable_Events(connection);
return connection;
_GSocket_Enable_Events(connection);
return connection;
sck->m_error = GSOCK_IOERR;
return GSOCK_IOERR;
}
sck->m_error = GSOCK_IOERR;
return GSOCK_IOERR;
}
+#if defined(__EMX__) || defined(__VISAGECPP__)
+ ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
+#else
ioctl(sck->m_fd, FIONBIO, &arg);
ioctl(sck->m_fd, FIONBIO, &arg);
_GSocket_Enable_Events(sck);
/* Connect it to the peer address, with a timeout (see below) */
_GSocket_Enable_Events(sck);
/* Connect it to the peer address, with a timeout (see below) */
sck->m_error = GSOCK_IOERR;
return GSOCK_IOERR;
}
sck->m_error = GSOCK_IOERR;
return GSOCK_IOERR;
}
+#if defined(__EMX__) || defined(__VISAGECPP__)
+ ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
+#else
ioctl(sck->m_fd, FIONBIO, &arg);
ioctl(sck->m_fd, FIONBIO, &arg);
_GSocket_Enable_Events(sck);
/* Bind to the local address,
_GSocket_Enable_Events(sck);
/* Bind to the local address,
MASK_SIGNAL();
ret = send(socket->m_fd, buffer, size, 0);
UNMASK_SIGNAL();
MASK_SIGNAL();
ret = send(socket->m_fd, buffer, size, 0);
UNMASK_SIGNAL();
+#else
+ ret = send(socket->m_fd, (char *)buffer, size, 0);
+#endif
MASK_SIGNAL();
ret = sendto(socket->m_fd, buffer, size, 0, addr, len);
UNMASK_SIGNAL();
MASK_SIGNAL();
ret = sendto(socket->m_fd, buffer, size, 0, addr, len);
UNMASK_SIGNAL();
+#else
+ ret = sendto(socket->m_fd, (char *)buffer, size, 0, addr, len);
+#endif
/* Frees memory allocated from _GAddress_translate_to */
free(addr);
/* Frees memory allocated from _GAddress_translate_to */
free(addr);
{
#else
/* Use gethostbyname by default */
{
#else
/* Use gethostbyname by default */
+ int val = 1; //VA doesn't like constants in conditional expressions at all
+ if (val)
{
#endif
struct in_addr *array_addr;
{
#endif
struct in_addr *array_addr;
* -------------------------------------------------------------------------
*/
* -------------------------------------------------------------------------
*/
GSocketError _GAddress_Init_UNIX(GAddress *address)
{
address->m_len = sizeof(struct sockaddr_un);
GSocketError _GAddress_Init_UNIX(GAddress *address)
{
address->m_len = sizeof(struct sockaddr_un);
+#endif /* !defined(__VISAGECPP__) */
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */