Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PIPDatagramSocket::WriteTo ( const void *  buf,
PINDEX  len,
const Address addr,
WORD  port 
) [virtual, inherited]

Write a datagram to a remote computer.

Returns:
TRUE if all the bytes were sucessfully written.
Parameters:
buf  Data to be written as URGENT TCP data.
len  Number of bytes pointed to by buf#.
addr  Address to which the datagram is sent.
port  Port to which the datagram is sent.

Reimplemented in PSocksUDPSocket.

Definition at line 2855 of file sockets.cxx.

Referenced by PSocksUDPSocket::WriteTo().

{
  lastWriteCount = 0;

#if P_HAS_IPV6

  Psockaddr sa(addr, port);
  return os_sendto(buf, len, 0, sa, sa.GetSize()) && lastWriteCount >= len;

#else

  sockaddr_in sockAddr;
  sockAddr.sin_family = AF_INET;
  sockAddr.sin_addr = addr;
  sockAddr.sin_port = htons(port);
  return os_sendto(buf, len, 0, (struct sockaddr *)&sockAddr, sizeof(sockAddr))
         && lastWriteCount >= len;

#endif
}


Generated by  Doxygen 1.6.0   Back to index