Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/ecole_etude_fac_de_pau/licence_3/projet_commun_se/backup05/client.c

(Deskargatu)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <signal.h>
#include <sys/types.h>
#include <errno.h>

#include <rpc/xdr.h>

#include "include/tcp.h"
#include "include/demandes.h"

int main(int argc, char** argv)
{
    int sock = con_tcp(4000,"localhost");
//    printf("Client %d\n",sock);
    
    XDR data;
    data.x_op=XDR_ENCODE;
    xdrrec_create(&data, 0, 0, (void*)sock, (void*)read_tcp, (void*)write_tcp);

    demande_item dem;
    dem.op=1;
    dem.demi=2;
    dem.peinte=3;
    
    if (!xdr_demande(&data,&dem)) { perror("clients.c xdr_demande"); exit(-1); }
    printf("ENVOIE DU demande\n");
    if (!xdrrec_endofrecord(&data, TRUE)) { perror("clients.c xdr_eof_rec"); exit(-1); }    
    xdr_destroy(&data);    
    while(1);
    close(sock);    
    
    
    return 0;
}