3 /* trp_tcp_client: Client 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[]) {
21 memset(data_send, 0, sizeof(data_send));
22 memset(data_recv, 0, sizeof(data_recv));
24 gras_init(&argc,argv);
26 fprintf(stderr,"===[CLIENT]=== Contact the server\n");
27 sock = gras_socket_client(NULL,55555);
29 sprintf(data_send,"Hello, I am a little test data to send.");
30 fprintf(stderr,"===[CLIENT]=== Send data\n");
31 gras_trp_send(sock,data_send, sizeof(data_send),1);
33 fprintf(stderr,"===[CLIENT]=== Waiting for the ACK\n");
34 gras_trp_recv(sock,data_recv, sizeof(data_recv));
36 if (strcmp(data_send, data_recv)) {
37 fprintf(stderr, "===[CLIENT]=== String sent != string received\n");
40 fprintf(stderr,"===[CLIENT]=== Got a valid ACK\n");
42 fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
43 gras_socket_close(sock);