3 /* trp_tcp_server: Server of a test case for the tcp transport. */
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
12 #include "gras/Transport/transport_interface.h"
14 XBT_LOG_NEW_CATEGORY(test,"Logging for this test");
16 int main(int argc,char *argv[]) {
17 gras_socket_t sock, conn;
20 gras_init(&argc,argv);
22 fprintf(stderr,"===[SERVER]=== Create the socket\n");
23 sock = gras_socket_server(55555);
25 fprintf(stderr,"===[SERVER]=== Waiting for incomming connexions\n");
26 conn = gras_trp_select(60);
28 fprintf(stderr,"===[SERVER]=== Contacted ! Waiting for the data\n");
29 gras_trp_recv(conn,data_recv, sizeof(data_recv));
30 fprintf(stderr,"===[SERVER]=== Got '%s'. Send it back.\n", data_recv);
31 gras_trp_send(conn,data_recv, sizeof(data_recv),1);
33 gras_socket_close(conn);
35 fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
36 gras_socket_close(sock);