#include <stddef.h>
#include <ctype.h>
-/* if we use configure for MSW SOCKLEN_T will be already defined */
-#ifndef SOCKLEN_T
-# define SOCKLEN_T int
+/* if we use configure for MSW WX_SOCKLEN_T will be already defined */
+#ifndef WX_SOCKLEN_T
+# define WX_SOCKLEN_T int
#endif
/* Table of GUI-related functions. We must call them indirectly because
{
GAddress *address;
struct sockaddr addr;
- SOCKLEN_T size = sizeof(addr);
+ WX_SOCKLEN_T size = sizeof(addr);
GSocketError err;
assert(this);
if ((bind(m_fd, m_local->m_addr, m_local->m_len) != 0) ||
(getsockname(m_fd,
m_local->m_addr,
- (SOCKLEN_T *)&m_local->m_len) != 0) ||
+ (WX_SOCKLEN_T *)&m_local->m_len) != 0) ||
(listen(m_fd, 5) != 0))
{
Close();
{
GSocket *connection;
struct sockaddr from;
- SOCKLEN_T fromlen = sizeof(from);
+ WX_SOCKLEN_T fromlen = sizeof(from);
GSocketError err;
u_long arg = 1;
if ((bind(m_fd, m_local->m_addr, m_local->m_len) != 0) ||
(getsockname(m_fd,
m_local->m_addr,
- (SOCKLEN_T *)&m_local->m_len) != 0))
+ (WX_SOCKLEN_T *)&m_local->m_len) != 0))
{
Close();
m_error = GSOCK_IOERR;
/* If the socket is blocking, wait for data (with a timeout) */
if (Input_Timeout() == GSOCK_TIMEDOUT)
+ {
+ m_error = GSOCK_TIMEDOUT;
return -1;
+ }
/* Read the data */
if (m_stream)
if (m_establishing && !m_server)
{
int error;
- SOCKLEN_T len = sizeof(error);
+ WX_SOCKLEN_T len = sizeof(error);
m_establishing = false;
int GSocket::Recv_Dgram(char *buffer, int size)
{
struct sockaddr from;
- SOCKLEN_T fromlen = sizeof(from);
+ WX_SOCKLEN_T fromlen = sizeof(from);
int ret;
GSocketError err;
CHECK_ADDRESS(address, INET);
addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr);
- addr->s_addr = htonl(hostaddr);;
+ addr->s_addr = htonl(hostaddr);
return GSOCK_NOERROR;
}