* -------------------------------------------------------------------------
*/
+#if defined(__GSOCKET_STANDALONE__) || defined(wxUSE_SOCKETS)
+
#ifndef __GSOCKET_STANDALONE__
#include "wx/setup.h"
* be available and it must containt the app's instance
* handle.
*/
-#define INSTANCE hInst
+#define INSTANCE hInst
#endif /* __GSOCKET_STANDALONE__ */
-#if defined(__GSOCKET_STANDALONE__) || defined(wxUSE_SOCKETS)
-
#include <assert.h>
#include <string.h>
#include <stdio.h>
socket->m_stream = TRUE;
socket->m_non_blocking = FALSE;
socket->m_timeout.tv_sec = 10 * 60; /* 10 minutes */
- socket->m_timeout.tv_usec = 0;
+ socket->m_timeout.tv_usec = 0;
/* Allocate a new message number for this socket */
EnterCriticalSection(&critical);
}
return GSOCK_NOERROR;
-}
+}
/* GSocket_WaitConnection:
* Waits for an incoming client connection.
case GSOCK_OUTPUT: mask |= FD_WRITE; break;
case GSOCK_CONNECTION: mask |= (FD_ACCEPT | FD_CONNECT); break;
case GSOCK_LOST: mask |= FD_CLOSE; break;
- }
+ }
}
}
int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size)
{
int ret;
-
+
ret = recv(socket->m_fd, buffer, size, 0);
if (ret == SOCKET_ERROR)
int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size)
{
struct sockaddr from;
- SOCKLEN_T fromlen;
+ SOCKLEN_T fromlen;
int ret;
fromlen = sizeof(from);
addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr);
addr->s_addr = inet_addr(hostname);
-
+
/* If it is a numeric host name, convert it now */
if (addr->s_addr == INADDR_NONE)
{
address->m_error = GSOCK_INVPORT;
return GSOCK_INVOP;
}
-
+
se = getservbyname(port, protocol);
if (!se)
{
assert(address != NULL);
CHECK_ADDRESS(address, INET, GSOCK_INVADDR);
-
+
addr = (struct sockaddr_in *)address->m_addr;
addr->sin_port = htons(port);
char *addr_buf;
struct sockaddr_in *addr;
- assert(address != NULL);
+ assert(address != NULL);
CHECK_ADDRESS(address, INET, GSOCK_INVADDR);
addr = (struct sockaddr_in *)address->m_addr;
{
struct sockaddr_in *addr;
- assert(address != NULL);
- CHECK_ADDRESS(address, INET, 0);
+ assert(address != NULL);
+ CHECK_ADDRESS(address, INET, 0);
addr = (struct sockaddr_in *)address->m_addr;
{
struct sockaddr_in *addr;
- assert(address != NULL);
- CHECK_ADDRESS(address, INET, 0);
+ assert(address != NULL);
+ CHECK_ADDRESS(address, INET, 0);
addr = (struct sockaddr_in *)address->m_addr;
return ntohs(addr->sin_port);