您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ G_IO_STREAM函数代码示例

51自学网 2021-06-01 21:01:21
  C++
这篇教程C++ G_IO_STREAM函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中G_IO_STREAM函数的典型用法代码示例。如果您正苦于以下问题:C++ G_IO_STREAM函数的具体用法?C++ G_IO_STREAM怎么用?C++ G_IO_STREAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了G_IO_STREAM函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: connect_cb

static voidconnect_cb(GObject *source,           GAsyncResult *res,           gpointer user_data){    GSocketConnection *socket_conn;    PnNode *conn;    GError *error = NULL;    conn = PN_NODE(user_data);    socket_conn = g_socket_client_connect_to_host_finish(G_SOCKET_CLIENT(source), res, &error);    g_object_unref(source);    if (error) {        g_error_free(error);        return;    }    g_object_ref(conn);    if (socket_conn) {        GSocket *socket;        GInputStream *input;        conn->socket_conn = socket_conn;        socket = g_socket_connection_get_socket(socket_conn);        conn->status = PN_NODE_STATUS_OPEN;        input = g_io_stream_get_input_stream (G_IO_STREAM (conn->socket_conn));        g_object_ref (conn);        g_input_stream_read_async (input, conn->input_buffer, PN_BUF_LEN,                                   G_PRIORITY_DEFAULT, NULL,                                   read_cb, conn);    }    else {        conn->error = g_error_new_literal(PN_NODE_ERROR, PN_NODE_ERROR_OPEN,                                          "Unable to connect");        pn_node_error(conn);    }    {        PnNodeClass *class;        class = g_type_class_peek(PN_NODE_TYPE);        g_signal_emit(G_OBJECT(conn), class->open_sig, 0, conn);    }    g_object_unref(conn);}
开发者ID:felipec,项目名称:msn-pecan,代码行数:51,


示例2: xr_client_open

gboolean xr_client_open(xr_client_conn* conn, const char* uri, GError** err){  GError* local_err = NULL;  g_return_val_if_fail(conn != NULL, FALSE);  g_return_val_if_fail(uri != NULL, FALSE);  g_return_val_if_fail(!conn->is_open, FALSE);  g_return_val_if_fail(err == NULL || *err == NULL, FALSE);  xr_trace(XR_DEBUG_CLIENT_TRACE, "(conn=%p, uri=%s)", conn, uri);  // parse URI format: http://host:8080/RES  g_free(conn->host);  g_free(conn->resource);  conn->host = NULL;  conn->resource = NULL;  if (!_parse_uri(uri, &conn->secure, &conn->host, &conn->resource))  {    g_set_error(err, XR_CLIENT_ERROR, XR_CLIENT_ERROR_FAILED, "invalid URI format: %s", uri);    return FALSE;  }  // enable/disable TLS  if (conn->secure)  {    g_socket_client_set_tls(conn->client, TRUE);    g_socket_client_set_tls_validation_flags(conn->client, G_TLS_CERTIFICATE_VALIDATE_ALL & ~G_TLS_CERTIFICATE_UNKNOWN_CA & ~G_TLS_CERTIFICATE_BAD_IDENTITY);  }  else  {    g_socket_client_set_tls(conn->client, FALSE);  }  conn->conn = g_socket_client_connect_to_host(conn->client, conn->host, 80, NULL, &local_err);  if (local_err)  {    g_propagate_prefixed_error(err, local_err, "Connection failed: ");    return FALSE;  }  xr_set_nodelay(g_socket_connection_get_socket(conn->conn));  conn->http = xr_http_new(G_IO_STREAM(conn->conn));  g_free(conn->session_id);  conn->session_id = g_strdup_printf("%08x%08x%08x%08x", g_random_int(), g_random_int(), g_random_int(), g_random_int());  conn->is_open = 1;  xr_client_set_http_header(conn, "X-SESSION-ID", conn->session_id);  return TRUE;}
开发者ID:djdominoSVK,项目名称:libxr,代码行数:51,


示例3: ekg_gnutls_new_session

static void ekg_gnutls_new_session(		GSocketClient *sockclient,		GSocketConnection *sock,		struct ekg_connection_starter *cs){	gnutls_session_t s;	gnutls_certificate_credentials_t cred;	struct ekg_gnutls_connection *conn = g_slice_new(struct ekg_gnutls_connection);	struct ekg_gnutls_connection_starter *gcs = g_slice_new(struct ekg_gnutls_connection_starter);	g_assert(!gnutls_certificate_allocate_credentials(&cred));	g_assert(!gnutls_init(&s, GNUTLS_CLIENT));	g_assert(!gnutls_priority_set_direct(s, "PERFORMANCE", NULL)); /* XXX */	g_assert(!gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, cred));	gnutls_transport_set_pull_function(s, ekg_gnutls_pull);	gnutls_transport_set_push_function(s, ekg_gnutls_push);	gnutls_transport_set_ptr(s, conn);	gcs->parent = cs;	gcs->conn = conn;	gcs->sockclient = sockclient;	conn->session = s;	conn->cred = cred;	conn->connection_error = NULL;	conn->connection = get_connection_by_outstream(			ekg_connection_add(				sock,				g_io_stream_get_input_stream(G_IO_STREAM(sock)),				g_io_stream_get_output_stream(G_IO_STREAM(sock)),				ekg_gnutls_handle_handshake_input,				ekg_gnutls_handle_handshake_failure,				gcs)			);	g_assert(conn->connection);	ekg_gnutls_async_handshake(gcs);}
开发者ID:AdKwiatkos,项目名称:ekg2,代码行数:38,


示例4: handler

static gbooleanhandler (GThreadedSocketService *service,         GSocketConnection      *connection,         GSocketListener        *listener,         gpointer                user_data){    GOutputStream *out;    GInputStream *in;    char buffer[1024];    gssize size;    out = g_io_stream_get_output_stream (G_IO_STREAM (connection));    in = g_io_stream_get_input_stream (G_IO_STREAM (connection));    g_output_stream_write_all (out, MESSAGE, strlen (MESSAGE),                               NULL, NULL, NULL);    while (0 < (size = g_input_stream_read (in, buffer,                                            sizeof buffer, NULL, NULL)))        g_output_stream_write (out, buffer, size, NULL, NULL);    return TRUE;}
开发者ID:DreaminginCodeZH,项目名称:glib,代码行数:23,


示例5: on_io_closed

static voidon_io_closed (GObject *stream,              GAsyncResult *result,              gpointer user_data){  GError *error = NULL;  if (!g_io_stream_close_finish (G_IO_STREAM (stream), result, &error))    {      if (!should_suppress_output_error (error))        g_message ("http close error: %s", error->message);      g_error_free (error);    }}
开发者ID:briceburg,项目名称:cockpit,代码行数:14,


示例6: onConnection

//------------------------------------------------------------------------------gboolean onConnection(GSocketService *server,		      GSocketConnection *connection,		      GObject *sourceObject,		      gpointer userData){    g_print("connection/n");	    GInputStream *istream = g_io_stream_get_input_stream(G_IO_STREAM(connection));       ConnData *data = new ConnData;    ostream = g_io_stream_get_output_stream(G_IO_STREAM(connection));    data->connection = (GSocketConnection*)g_object_ref(connection);    g_input_stream_read_async(istream,			      data->message,			      sizeof (data->message),			      G_PRIORITY_DEFAULT,			      NULL,			      onMessage,			      data);    return FALSE;}
开发者ID:j-a-r-i,项目名称:GHwIf,代码行数:24,


示例7: socket_callback

/* command socket callback */gboolean socket_callback(GSocketService * service, GSocketConnection * conn,                         GObject * source_object, gpointer user_data){    video_server_t * server = (video_server_t *)user_data;    gchar            message[128];    guint64          value;    GInputStream * istream = g_io_stream_get_input_stream(G_IO_STREAM(conn));    g_input_stream_read(istream, message, 128, NULL, NULL);    /* Supported commands:     *     *   "b 5000"     set bitrate to 5 Mbps     *   "i 3000"     set I-frame interval in msec     *   "f 30"       set framerate in frames/sec     *   "s 640x360"  set frame size     */    gchar **cmd_str = g_strsplit(message, " ", 0);    if (g_strv_length(cmd_str) != 2)    {        fprintf(stderr, "Incorrect command syntax: %s", message);        return FALSE;    }    switch (cmd_str[0][0])    {    case 'b':        value = g_ascii_strtoull(cmd_str[1], NULL, 0);        video_server_set_bitrate(server, (unsigned int) value);        break;    case 'i':        value = g_ascii_strtoull(cmd_str[1], NULL, 0);        video_server_set_iframe_period(server, (unsigned int) value);        break;    case 'f':        value = g_ascii_strtoull(cmd_str[1], NULL, 0);        video_server_set_framerate(server, (unsigned int) value);        break;    case 's':        get_frame_size(cmd_str[1], server->conf);        video_server_reset_frame_size(server);        break;    }    g_strfreev(cmd_str);    return FALSE;}
开发者ID:DevelopmentWeb,项目名称:bonecam,代码行数:50,


示例8: stream_tube_connection_closed_cb

static voidstream_tube_connection_closed_cb (GObject *source,    GAsyncResult *result,    gpointer user_data){  GError *error = NULL;  if (!g_io_stream_close_finish (G_IO_STREAM (source), result, &error))    {      DEBUG ("Failed to close connection: %s", error->message);      g_error_free (error);      return;    }}
开发者ID:izaackgerard,项目名称:Sintetizador_Voz,代码行数:15,


示例9: connectedCallback

static void connectedCallback(GSocketClient* client, GAsyncResult* result, void* id){    // Always finish the connection, even if this SocketStreamHandle was deactivated earlier.    GOwnPtr<GError> error;    GSocketConnection* socketConnection = g_socket_client_connect_to_host_finish(client, result, &error.outPtr());    // The SocketStreamHandle has been deactivated, so just close the connection, ignoring errors.    SocketStreamHandle* handle = getHandleFromId(id);    if (!handle) {        g_io_stream_close(G_IO_STREAM(socketConnection), 0, &error.outPtr());        return;    }    handle->connected(socketConnection, error.get());}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:15,


示例10: seekFile

long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin){    GSeekType seekType = G_SEEK_SET;    switch (origin) {    case SeekFromBeginning:        seekType = G_SEEK_SET;        break;    case SeekFromCurrent:        seekType = G_SEEK_CUR;        break;    case SeekFromEnd:        seekType = G_SEEK_END;        break;    default:        ASSERT_NOT_REACHED();    }    if (!g_seekable_seek(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))),        offset, seekType, 0, 0))    {        return -1;    }    return g_seekable_tell(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))));}
开发者ID:caiolima,项目名称:webkit,代码行数:24,


示例11: on_io_closed

static voidon_io_closed (GObject *stream,              GAsyncResult *result,              gpointer user_data){  GError *error = NULL;  if (!g_io_stream_close_finish (G_IO_STREAM (stream), result, &error))    {      if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE))        g_debug ("http close error: %s", error->message);      else        g_message ("http close error: %s", error->message);      g_error_free (error);    }}
开发者ID:leospol,项目名称:cockpit,代码行数:16,


示例12: g_tls_client_connection_new

/** * g_tls_client_connection_new: * @base_io_stream: the #GIOStream to wrap * @server_identity: (allow-none): the expected identity of the server * @error: #GError for error reporting, or %NULL to ignore. * * Creates a new #GTlsClientConnection wrapping @base_io_stream (which * must have pollable input and output streams) which is assumed to * communicate with the server identified by @server_identity. * * Returns: (transfer full) (type GTlsClientConnection): the new * #GTlsClientConnection, or %NULL on error * * Since: 2.28 */GIOStream *g_tls_client_connection_new (GIOStream           *base_io_stream,			     GSocketConnectable  *server_identity,			     GError             **error){  GObject *conn;  GTlsBackend *backend;  backend = g_tls_backend_get_default ();  conn = g_initable_new (g_tls_backend_get_client_connection_type (backend),			 NULL, error,			 "base-io-stream", base_io_stream,			 "server-identity", server_identity,			 NULL);  return G_IO_STREAM (conn);}
开发者ID:QuentinFiard,项目名称:glib,代码行数:31,


示例13: on_incoming_connection

static gbooleanon_incoming_connection (GSocketService * service,                        GSocketConnection * connection,                        GObject * source_object,                        gpointer user_data){  GInputStream * input;  void * buf;  input = g_io_stream_get_input_stream (G_IO_STREAM (connection));  buf = g_malloc (1);  g_input_stream_read_async (input, buf, 1, G_PRIORITY_DEFAULT, NULL,      on_read_ready, NULL);  return TRUE;}
开发者ID:luiseduardohdbackup,项目名称:frida-gum,代码行数:16,


示例14: g_tls_server_connection_new

/** * g_tls_server_connection_new: * @base_io_stream: the #GIOStream to wrap * @certificate: (allow-none): the default server certificate, or %NULL * @error: #GError for error reporting, or %NULL to ignore. * * Creates a new #GTlsServerConnection wrapping @base_io_stream (which * must have pollable input and output streams). * * Return value: (transfer full): the new #GTlsServerConnection, or %NULL on error * * Since: 2.28 */GIOStream *g_tls_server_connection_new (GIOStream        *base_io_stream,			     GTlsCertificate  *certificate,			     GError          **error){  GObject *conn;  GTlsBackend *backend;  backend = g_tls_backend_get_default ();  conn = g_initable_new (g_tls_backend_get_server_connection_type (backend),			 NULL, error,			 "base-io-stream", base_io_stream,			 "certificate", certificate,			 NULL);  return G_IO_STREAM (conn);}
开发者ID:BreakawayConsulting,项目名称:glib,代码行数:29,


示例15: gum_duk_debug_channel_add_session

static voidgum_duk_debug_channel_add_session (GumDukDebugChannel * self,                                   GSocketConnection * connection){  gboolean is_first_session;  GumDukDebugSession * session;  is_first_session = self->sessions == NULL;  session = gum_duk_debug_session_new (self, G_IO_STREAM (connection));  self->sessions = g_slist_prepend (self->sessions, session);  gum_duk_debug_session_open (session);  if (is_first_session)    gum_duk_debug_channel_attach (self);}
开发者ID:aonorin,项目名称:frida-gum,代码行数:17,


示例16: jetdirect_connection_test_cb

static voidjetdirect_connection_test_cb (GObject      *source_object,                              GAsyncResult *res,                              gpointer      user_data){  GSocketConnection *connection;  PpHostPrivate     *priv;  PpPrintDevice     *device;  JetDirectData     *data;  gpointer           result;  GError            *error = NULL;  GTask             *task = G_TASK (user_data);  data = g_task_get_task_data (task);  connection = g_socket_client_connect_to_host_finish (G_SOCKET_CLIENT (source_object),                                                       res,                                                       &error);  if (connection != NULL)    {      g_io_stream_close (G_IO_STREAM (connection), NULL, NULL);      g_object_unref (connection);      priv = data->host->priv;      device = g_new0 (PpPrintDevice, 1);      device->device_class = g_strdup ("network");      device->device_uri = g_strdup_printf ("socket://%s:%d",                                            priv->hostname,                                            data->port);      /* Translators: The found device is a JetDirect printer */      device->device_name = g_strdup (_("JetDirect Printer"));      device->host_name = g_strdup (priv->hostname);      device->host_port = data->port;      device->acquisition_method = ACQUISITION_METHOD_JETDIRECT;      data->devices->devices = g_list_append (data->devices->devices, device);    }  result = data->devices;  data->devices = NULL;  g_task_return_pointer (task, result, (GDestroyNotify) pp_devices_list_free);  g_object_unref (task);}
开发者ID:1dot75cm,项目名称:gnome-control-center,代码行数:45,


示例17: identd_incoming_cb

static gbooleanidentd_incoming_cb (GSocketService *service, GSocketConnection *conn,                    GObject *source, gpointer userdata){    GInputStream *stream;    ident_info *info;    info = g_new0 (ident_info, 1);    info->conn = conn;    g_object_ref (conn);    stream = g_io_stream_get_input_stream (G_IO_STREAM (conn));    g_input_stream_read_async (stream, info->read_buf, sizeof (info->read_buf), G_PRIORITY_DEFAULT,                               NULL, (GAsyncReadyCallback)identd_read_ready, info);    return TRUE;}
开发者ID:HextorIRC,项目名称:hextor,代码行数:18,


示例18: g_vfs_ftp_connection_open_data_connection

gbooleang_vfs_ftp_connection_open_data_connection (GVfsFtpConnection *conn,                                           GSocketAddress *   addr,                                           GCancellable *     cancellable,                                           GError **          error){  g_return_val_if_fail (conn != NULL, FALSE);  g_return_val_if_fail (conn->data == NULL, FALSE);  g_vfs_ftp_connection_stop_listening (conn);  conn->data = G_IO_STREAM (g_socket_client_connect (conn->client,                                                     G_SOCKET_CONNECTABLE (addr),                                                     cancellable,                                                     error));  return conn->data != NULL;}
开发者ID:BATYakhkhkh,项目名称:gvfs,代码行数:18,


示例19: main

intmain (int argc, char *argv[]){   /* initialize glib */  //g_type_init ();  GError * error = NULL;  /* create a new connection */  GSocketConnection * connection = NULL;  GSocketClient * client = g_socket_client_new();  /* connect to the host */  connection = g_socket_client_connect_to_host (client,                                               (gchar*)"localhost",                                                2345, /* your port goes here */                                                NULL,                                                &error);  /* don't forget to check for errors */  if (error != NULL)  {      g_error (error->message);  }  else  {      g_print ("Connection successful!/n");  }  /* use the connection */  //GInputStream * istream = g_io_stream_get_input_stream (G_IO_STREAM (connection));  GOutputStream * ostream = g_io_stream_get_output_stream (G_IO_STREAM (connection));  g_output_stream_write  (ostream,                          "Hello server!", /* your message goes here */                          13, /* length of your message */                          NULL,                          &error);  /* don't forget to check for errors */  if (error != NULL)  {      g_error (error->message);  }  return 0;}
开发者ID:unclejamil,项目名称:glib-cookbook,代码行数:44,


示例20: zpj_download_stream_ready

static voidzpj_download_stream_ready (GObject *source,                       GAsyncResult *res,                       gpointer user_data){  GError *error = NULL;  PdfLoadJob *job = (PdfLoadJob *) user_data;  const gchar *name;  const gchar *extension;  job->stream = zpj_skydrive_download_file_to_stream_finish (ZPJ_SKYDRIVE (source), res, &error);  if (error != NULL) {    pdf_load_job_complete_error (job, error);    return;  }  name = zpj_skydrive_entry_get_name (job->zpj_entry);  extension = gd_filename_get_extension_offset (name);  /* If it is not a PDF, we need to convert it afterwards.   * http://msdn.microsoft.com/en-us/library/live/hh826545#fileformats   */  if (g_strcmp0 (extension, ".pdf") != 0)    {      GFileIOStream *iostream;      job->download_file = g_file_new_tmp (NULL, &iostream, &error);      if (error != NULL) {        pdf_load_job_complete_error (job, error);        return;      }      /* We don't need the iostream. */      g_io_stream_close (G_IO_STREAM (iostream), NULL, NULL);    }  else    job->download_file = g_file_new_for_path (job->pdf_path);  g_file_replace_async (job->download_file, NULL, FALSE,                        G_FILE_CREATE_PRIVATE,                        G_PRIORITY_DEFAULT,                        job->cancellable, file_replace_ready_cb,                        job);}
开发者ID:TiredFingers,项目名称:gnome-documents,代码行数:44,


示例21: util_write_tmp_file_from_bytes

/** * Stream write buffer to a temporary file (in one go) * * @param buffer The buffer to write * @param count Size of the buffer to write * * @return the filename of the buffer that was written */gchar* util_write_tmp_file_from_bytes ( const void *buffer, gsize count ){	GFileIOStream *gios;	GError *error = NULL;	gchar *tmpname = NULL;#if GLIB_CHECK_VERSION(2,32,0)	GFile *gf = g_file_new_tmp ( "vik-tmp.XXXXXX", &gios, &error );	tmpname = g_file_get_path (gf);#else	gint fd = g_file_open_tmp ( "vik-tmp.XXXXXX", &tmpname, &error );	if ( error ) {		g_warning ( "%s", error->message );		g_error_free ( error );		return NULL;	}	gios = g_file_open_readwrite ( g_file_new_for_path (tmpname), NULL, &error );	if ( error ) {		g_warning ( "%s", error->message );		g_error_free ( error );		return NULL;	}#endif	gios = g_file_open_readwrite ( g_file_new_for_path (tmpname), NULL, &error );	if ( error ) {		g_warning ( "%s", error->message );		g_error_free ( error );		return NULL;	}	GOutputStream *gos = g_io_stream_get_output_stream ( G_IO_STREAM(gios) );	if ( g_output_stream_write ( gos, buffer, count, NULL, &error ) < 0 ) {		g_critical ( "Couldn't write tmp %s file due to %s", tmpname, error->message );		g_free (tmpname);		tmpname = NULL;	}	g_output_stream_close ( gos, NULL, &error );	g_object_unref ( gios );	return tmpname;}
开发者ID:LebedevRI,项目名称:viking,代码行数:51,


示例22: _close_ready

static void _close_ready(GObject *source_object, GAsyncResult *res, gpointer user_data) {	GIOStream *io_stream = G_IO_STREAM(source_object);	GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT(user_data);	IdleServerConnection *conn = IDLE_SERVER_CONNECTION(g_async_result_get_source_object(G_ASYNC_RESULT(result)));	IdleServerConnectionPrivate *priv = IDLE_SERVER_CONNECTION_GET_PRIVATE(conn);	GError *error = NULL;	change_state(conn, SERVER_CONNECTION_STATE_NOT_CONNECTED, priv->reason);	g_object_unref(conn);	if (!g_io_stream_close_finish(io_stream, res, &error)) {		IDLE_DEBUG("g_io_stream_close failed: %s", error->message);		g_simple_async_result_set_error(result, TP_ERROR, TP_ERROR_NETWORK_ERROR, "%s", error->message);		g_error_free(error);	}	g_simple_async_result_complete(result);	g_object_unref(result);}
开发者ID:izaackgerard,项目名称:Sintetizador_Voz,代码行数:19,


示例23: do_connect

static gboolean do_connect(MegaHttpClient* http_client, GCancellable* cancellable, GError** err){  GError* local_err = NULL;  g_return_val_if_fail(MEGA_IS_HTTP_CLIENT(http_client), FALSE);  g_return_val_if_fail(err == NULL || *err == NULL, FALSE);  MegaHttpClientPrivate* priv = http_client->priv;  do_disconnect(http_client);  // enable/disable TLS  if (priv->https)  {    if (!g_tls_backend_supports_tls(g_tls_backend_get_default()))     {      g_set_error(err, MEGA_HTTP_CLIENT_ERROR, MEGA_HTTP_CLIENT_ERROR_OTHER, "TLS backend not found, please install glib-networking.");      return FALSE;    }    g_socket_client_set_tls(priv->client, TRUE);  }  else  {    g_socket_client_set_tls(priv->client, FALSE);  }  priv->conn = g_socket_client_connect_to_host(priv->client, priv->host, priv->port, cancellable, &local_err);  if (!priv->conn)  {    g_propagate_prefixed_error(err, local_err, "Connection failed: ");    return FALSE;  }    GDataInputStream* data_stream = g_data_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(http_client->priv->conn)));  g_data_input_stream_set_newline_type(data_stream, G_DATA_STREAM_NEWLINE_TYPE_ANY);  priv->istream = G_INPUT_STREAM(data_stream);  priv->ostream = g_object_ref(g_io_stream_get_output_stream(G_IO_STREAM(http_client->priv->conn)));  return TRUE;}
开发者ID:crass,项目名称:megatools,代码行数:43,


示例24: deactivateHandle

void SocketStreamHandle::platformClose(){    // We remove this handle from the active handles list first, to disable all callbacks.    deactivateHandle(this);    stopWaitingForSocketWritability();    if (m_socketConnection) {        GOwnPtr<GError> error;        g_io_stream_close(G_IO_STREAM(m_socketConnection.get()), 0, &error.outPtr());        if (error)            m_client->didFail(this, SocketStreamError(error->code)); // FIXME: Provide a sensible error.        m_socketConnection = 0;    }    m_outputStream = 0;    m_inputStream = 0;    delete m_readBuffer;    m_client->didClose(this);}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:20,


示例25: send_reply

static voidsend_reply (BroadwayClient *client,	    BroadwayRequest *request,	    BroadwayReply *reply,	    gsize size,	    guint32 type){  GOutputStream *output;  reply->base.size = size;  reply->base.in_reply_to = request ? request->base.serial : 0;  reply->base.type = type;  output = g_io_stream_get_output_stream (G_IO_STREAM (client->connection));  if (!g_output_stream_write_all (output, reply, size, NULL, NULL, NULL))    {      g_printerr ("can't write to client");      client_disconnect_in_idle (client);    }}
开发者ID:3dfxmadscientist,项目名称:gnome-apps,代码行数:20,


示例26: g_vfs_afp_connection_get_server_info

GVfsAfpReply *g_vfs_afp_connection_get_server_info (GVfsAfpConnection *afp_connection,                                      GCancellable *cancellable,                                      GError **error){  GVfsAfpConnectionPrivate *priv = afp_connection->priv;    GSocketClient *client;  GIOStream *conn;  gboolean res;  DSIHeader dsi_header;  char *data;  client = g_socket_client_new ();  conn = G_IO_STREAM (g_socket_client_connect (client, priv->addr, cancellable, error));  g_object_unref (client);  if (!conn)    return NULL;  res = send_request_sync (g_io_stream_get_output_stream (conn), DSI_GET_STATUS,                           0, 0, 0, NULL, cancellable, error);  if (!res)  {    g_object_unref (conn);    return NULL;  }  res = read_reply_sync (g_io_stream_get_input_stream (conn), &dsi_header,                         &data, cancellable, error);  if (!res)  {    g_object_unref (conn);    return NULL;  }  g_object_unref (conn);    return g_vfs_afp_reply_new (dsi_header.errorCode, data,                              dsi_header.totalDataLength, TRUE);}
开发者ID:REPETUZ,项目名称:gvfs,代码行数:41,


示例27: main

int main(int argc, char *argv[]) {    LibWCRelay *relay = libwc_relay_new();    GSocketClient *socket_client = g_socket_client_new();    GSocketConnection *socket_connection;    gboolean result;    gchar *ping_result;    GError *error = NULL;    if (argc < 2) {        fprintf(stderr, "Usage: test-client <host[:port]>/n");        exit(1);    }    socket_connection = g_socket_client_connect_to_host(socket_client, argv[1],                                                        49153, NULL, &error);    END_IF_FAIL(socket_connection != NULL);    libwc_relay_password_set(relay, "test");    libwc_relay_connection_set(relay, G_IO_STREAM(socket_connection),                               g_socket_connection_get_socket(socket_connection));    result = libwc_relay_connection_init(relay, NULL, &error);    if (result)        printf("Connection successful!/n");    else {        fprintf(stderr, "Connection unsuccessful: %s/n",                error->message);        exit(1);    }    ping_result = libwc_relay_ping(relay, NULL, &error, TEST_PING_MESSAGE);    if (ping_result && strcmp(ping_result, TEST_PING_MESSAGE) == 0)        printf("Ping successful!/n");    else {        fprintf(stderr, "Ping unsuccessful: %s/n",                error->message);        exit(1);    }}
开发者ID:Lyude,项目名称:libweechat,代码行数:41,


示例28: codeslayer_utils_get_file_path

gchar*codeslayer_utils_get_file_path (const gchar *folder_path,                                 const gchar *file_name){  gchar *file_path;  GFile *file;  file_path = g_build_filename (folder_path, file_name, NULL);    file = g_file_new_for_path (file_path);  if (!g_file_query_exists (file, NULL))    {      GFileIOStream *stream;      stream = g_file_create_readwrite (file, G_FILE_CREATE_NONE, NULL, NULL);      g_io_stream_close (G_IO_STREAM (stream), NULL, NULL);      g_object_unref (stream);    }  g_object_unref (file);  return file_path;}
开发者ID:jeffjohnston,项目名称:codeslayer,代码行数:21,


示例29: LOG

void SocketStreamHandle::platformClose(){    LOG(Network, "SocketStreamHandle %p platformClose", this);    // We remove this handle from the active handles list first, to disable all callbacks.    deactivateHandle(this);    stopWaitingForSocketWritability();    if (m_socketConnection) {        GUniqueOutPtr<GError> error;        g_io_stream_close(G_IO_STREAM(m_socketConnection.get()), 0, &error.outPtr());        if (error)            m_client->didFailSocketStream(this, SocketStreamError(error->code, error->message));        m_socketConnection = 0;    }    m_outputStream = 0;    m_inputStream = 0;    m_readBuffer = nullptr;    m_client->didCloseSocketStream(this);}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:21,



注:本文中的G_IO_STREAM函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ G_IS_APP_INFO函数代码示例
C++ G_INPUT_STREAM函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。