Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Starting the network module.
[simgrid.git] / testsuite / gras / trp_file_server.c
1 /* $Id$ */
2
3 /* trp_tcp_server: Server of a test case for the tcp transport.             */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2003 the OURAGAN project.                                  */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #include <stdio.h>
12 #include <gras.h>
13 #include "gras/Transport/transport_interface.h"
14
15 /*XBT_LOG_NEW_DEFAULT_CATEGORY(test);*/
16
17 int main(int argc,char *argv[]) {
18   gras_socket_t sock, conn;
19   xbt_error_t errcode;
20   char data_recv[256];
21
22   xbt_init_defaultlog(&argc,argv,"trp.thresh=debug");
23
24   fprintf(stderr,"===[SERVER]=== Create the socket\n");
25   TRYFAIL(gras_socket_server_from_file("-",&sock));
26
27   fprintf(stderr,"===[SERVER]=== Waiting for incomming connexions\n");
28   TRYFAIL(gras_trp_select(60,&conn));
29
30   fprintf(stderr,"===[SERVER]=== Contacted ! Waiting for the data\n");
31   TRYFAIL(gras_trp_chunk_recv(conn,data_recv, sizeof(data_recv)));
32   fprintf(stderr,"===[SERVER]=== Got '%s'.\n", data_recv);
33
34   fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
35   gras_socket_close(sock);
36
37   xbt_exit();
38   return 0;
39 }