Variant f_stream_socket_sendto(CObjRef socket, CStrRef data,
                               int flags /* = 0 */,
                               CStrRef address /* = null_string */) {
  String host; int port;
  parse_host(address, host, port);
  return f_socket_sendto(socket, data, data.size(), flags, host, port);
}
Example #2
0
Variant f_stream_socket_sendto(CObjRef socket, CStrRef data,
                               int flags /* = 0 */,
                               CStrRef address /* = null_string */) {
  String host; int port;

  if (address == null_string) {
    Socket *sock = socket.getTyped<Socket>();
    host = sock->getAddress();
    port = sock->getPort();
  } else {
    parse_host(address, host, port);
  }

  return f_socket_sendto(socket, data, data.size(), flags, host, port);
}
Example #3
0
Variant f_stream_socket_sendto(const Resource& socket, const String& data,
                               int flags /* = 0 */,
                               const String& address /* = null_string */) {
  String host; int port;

  if (address == null_string) {
    Socket *sock = socket.getTyped<Socket>();
    host = sock->getAddress();
    port = sock->getPort();
  } else {
    HostURL hosturl(static_cast<std::string>(address));
    host = hosturl.getHost();
    port = hosturl.getPort();
  }

  return f_socket_sendto(socket, data, data.size(), flags, host, port);
}