* Sets up this socket as a server. The local address must have been
* set with GSocket_SetLocal() before GSocket_SetServer() is called.
* Returns GSOCK_NOERROR on success, one of the following otherwise:
* Sets up this socket as a server. The local address must have been
* set with GSocket_SetLocal() before GSocket_SetServer() is called.
* Returns GSOCK_NOERROR on success, one of the following otherwise:
_GSocket_Enable_Events(sck);
/* Bind to the local address,
_GSocket_Enable_Events(sck);
/* Bind to the local address,
* GSOCK_TIMEDOUT - timeout, no incoming connections.
* GSOCK_WOULDBLOCK - the call would block and the socket is nonblocking.
* GSOCK_MEMERR - couldn't allocate memory.
* GSOCK_TIMEDOUT - timeout, no incoming connections.
* GSOCK_WOULDBLOCK - the call would block and the socket is nonblocking.
* GSOCK_MEMERR - couldn't allocate memory.
- ioctl(connection->m_fd, FIONBIO, &arg);
+ ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
* GSOCK_TIMEDOUT - timeout, the connection failed.
* GSOCK_WOULDBLOCK - connection in progress (nonblocking sockets only)
* GSOCK_MEMERR - couldn't allocate memory.
* GSOCK_TIMEDOUT - timeout, the connection failed.
* GSOCK_WOULDBLOCK - connection in progress (nonblocking sockets only)
* GSOCK_MEMERR - couldn't allocate memory.
_GSocket_Enable_Events(sck);
/* Connect it to the peer address, with a timeout (see below) */
ret = connect(sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len);
printf("connect on %d to %X (%d) returned %d, errno = %d\n",
_GSocket_Enable_Events(sck);
/* Connect it to the peer address, with a timeout (see below) */
ret = connect(sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len);
printf("connect on %d to %X (%d) returned %d, errno = %d\n",
- sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len, ret, errno);
+ sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len, ret, errno);
_GSocket_Enable_Events(sck);
/* Bind to the local address,
_GSocket_Enable_Events(sck);
/* Bind to the local address,
ret = _GSocket_Recv_Stream(socket, buffer, size);
else
ret = _GSocket_Recv_Dgram(socket, buffer, size);
ret = _GSocket_Recv_Stream(socket, buffer, size);
else
ret = _GSocket_Recv_Dgram(socket, buffer, size);
GSocket_Debug(( "GSocket_Write #1, size %d\n", size ));
if (socket->m_fd == INVALID_SOCKET || socket->m_server)
GSocket_Debug(( "GSocket_Write #1, size %d\n", size ));
if (socket->m_fd == INVALID_SOCKET || socket->m_server)
ret = _GSocket_Send_Stream(socket, buffer, size);
else
ret = _GSocket_Send_Dgram(socket, buffer, size);
ret = _GSocket_Send_Stream(socket, buffer, size);
else
ret = _GSocket_Send_Dgram(socket, buffer, size);
GSocket_Debug(( "GSocket_Write #5, size %d ret %d\n", size, ret ));
return ret;
GSocket_Debug(( "GSocket_Write #5, size %d ret %d\n", size, ret ));
return ret;
* won't block. This event is generated only once, when the connection is
* first established, and then only if a call failed with GSOCK_WOULDBLOCK,
* when the output buffer empties again. This means that the app should
* won't block. This event is generated only once, when the connection is
* first established, and then only if a call failed with GSOCK_WOULDBLOCK,
* when the output buffer empties again. This means that the app should
if ((flags & (1 << count)) != 0)
{
printf("Setting callback no %d for socket at %X to address %X,data %X\n",
if ((flags & (1 << count)) != 0)
{
printf("Setting callback no %d for socket at %X to address %X,data %X\n",
- count, socket, callback, cdata);
+ count, socket, callback, cdata);
if ((flags & (1 << count)) != 0)
{
printf("Removing callback no %d for socket at %X",
if ((flags & (1 << count)) != 0)
{
printf("Removing callback no %d for socket at %X",
MASK_SIGNAL();
ret = send(socket->m_fd, buffer, size, 0);
UNMASK_SIGNAL();
MASK_SIGNAL();
ret = send(socket->m_fd, buffer, size, 0);
UNMASK_SIGNAL();
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();
if (inet_aton(hostname, addr) == 0)
{
#elif defined(HAVE_INET_ADDR)
if (inet_aton(hostname, addr) == 0)
{
#elif defined(HAVE_INET_ADDR)
CHECK_ADDRESS(address, INET);
addr = (struct sockaddr_in *)address->m_addr;
CHECK_ADDRESS(address, INET);
addr = (struct sockaddr_in *)address->m_addr;
- assert(address != NULL);
- CHECK_ADDRESS_RETVAL(address, INET, 0);
+ assert(address != NULL);
+ CHECK_ADDRESS_RETVAL(address, INET, 0);
- assert(address != NULL);
- CHECK_ADDRESS_RETVAL(address, INET, 0);
+ assert(address != NULL);
+ CHECK_ADDRESS_RETVAL(address, INET, 0);
addr = ((struct sockaddr_un *)address->m_addr);
memcpy(addr->sun_path, path, strlen(path));
addr = ((struct sockaddr_un *)address->m_addr);
memcpy(addr->sun_path, path, strlen(path));