3 /* trp_tcp_client: Client of a test case for the tcp transport. */
5 /* Authors: Martin Quinson */
6 /* Copyright (C) 2003 the OURAGAN project. */
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. */
13 #include "../Transport/transport_interface.h"
15 //GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
17 int main(int argc,char *argv[]) {
23 gras_init_defaultlog(&argc,argv,"trp.thresh=debug");
25 fprintf(stderr,"===[CLIENT]=== Contact the server\n");
26 TRYFAIL(gras_socket_client(NULL,55555,&sock));
28 sprintf(data_send,"Hello, I am a little test data to send.");
29 fprintf(stderr,"===[CLIENT]=== Send data\n");
30 TRYFAIL(gras_trp_chunk_send(sock,data_send, sizeof(data_send)));
31 fprintf(stderr,"===[CLIENT]=== Waiting for the ACK\n");
32 TRYFAIL(gras_trp_chunk_recv(sock,data_recv, sizeof(data_recv)));
34 if (strcmp(data_send, data_recv)) {
35 fprintf(stderr, "===[CLIENT]=== String sent != string received\n");
38 fprintf(stderr,"===[CLIENT]=== Got a valid ACK\n");
40 fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
41 gras_socket_close(&sock);