X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/58bce89d599a5bee49318c168f54fb407fbf5d24..8bca872ed1a62f660c0d5da333eece9edb1d05a4:/doc/gtut-files/04-callback.c diff --git a/doc/gtut-files/04-callback.c b/doc/gtut-files/04-callback.c index 1749ef2133..956f6b5847 100644 --- a/doc/gtut-files/04-callback.c +++ b/doc/gtut-files/04-callback.c @@ -1,3 +1,10 @@ +/* Copyright (c) 2006, 2007, 2010. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include #include int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload) { @@ -6,7 +13,7 @@ int server_hello_cb(gras_msg_cb_ctx_t ctx, void *payload) { fprintf(stderr,"Cool, we received the message from %s:%d.\n", gras_socket_peer_name(client), gras_socket_peer_port(client)); - return 1; + return 0; } /* end_of_callback */ int server(int argc, char *argv[]) { @@ -17,7 +24,7 @@ int server(int argc, char *argv[]) { gras_msgtype_declare("hello", NULL); mysock = gras_socket_server(atoi(argv[1])); - gras_cb_register(gras_msgtype_by_name("hello"),&server_hello_cb); + gras_cb_register("hello",&server_hello_cb); gras_msg_handle(60); gras_exit(); @@ -38,7 +45,7 @@ int client(int argc, char *argv[]) { gras_os_sleep(1.5); /* sleep 1 second and half */ toserver = gras_socket_client(argv[1], atoi(argv[2])); - gras_msg_send(toserver,gras_msgtype_by_name("hello"), NULL); + gras_msg_send(toserver,"hello", NULL); fprintf(stderr,"That's it, we sent the data to the server on %s\n", gras_socket_peer_name(toserver)); gras_exit();