X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=nlsop_client.c;h=201c48c63181c53c15d9da51022de4a1d128e054;hp=3f7654992c2d43752580e09041b71909ec01547e;hb=4c5373958d4b8d38e51560ba898cfd0473d7c108;hpb=b947acff653562c5be7d21128555a16f87924d18 diff --git a/nlsop_client.c b/nlsop_client.c index 3f76549..201c48c 100644 --- a/nlsop_client.c +++ b/nlsop_client.c @@ -306,27 +306,47 @@ void send_data(int signum) { int c; unsigned char data; + int fd; c=gd3_l->max_x*gd3_l->max_y*gd3_l->max_z; printf("%d <-\n",c); network_send(gnet->connection[0].fd,&dc,1); - /* + network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char)); + printf("debug: sent dc\n"); + network_send(gnet->connection[0].fd,(unsigned char *)gd3_l, sizeof(d3_lattice)); + network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char)); + printf("debug: sent d3_lattice\n"); + network_send(gnet->connection[0].fd,(unsigned char *)gmy_info,sizeof(info)); - */ - printf("debug: sent dc\n"); + network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char)); + printf("debug: sent info\n"); + network_send(gnet->connection[0].fd,gd3_l->status,c*sizeof(unsigned char)); network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char)); printf("debug: sent ac\n"); + network_send(gnet->connection[0].fd,(unsigned char *)gd3_l->extra, c*sizeof(int)); network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char)); printf("debug: sent cc\n"); + network_send(gnet->connection[0].fd,(unsigned char *)gi,sizeof(int)); network_receive(gnet->connection[0].fd,&data,sizeof(unsigned char)); + printf("debug: sent steps\n"); + + if(signum==121) { + printf("save test file\n"); + fd=open("./test.save",O_WRONLY|O_CREAT); + write(fd,gd3_l,sizeof(d3_lattice)); + write(fd,gmy_info,sizeof(info)); + write(fd,gd3_l->status,c*sizeof(unsigned char)); + write(fd,gd3_l->extra,c*sizeof(int)); + close(fd); + } } @@ -348,7 +368,7 @@ int main(int argc,char **argv) gnet=&net; /* default values */ - strcpy(server_ip,""); + strcpy(server_ip,"137.250.82.105"); strcpy(p_file,IMP_PROFILE); strcpy(n_e_file,NEL_PROFILE); strcpy(r_file,""); @@ -414,6 +434,8 @@ int main(int argc,char **argv) int nop(t_event *event,void *allineed) { + printf("\ni did a nop :)\n"); + return 1; } @@ -544,7 +566,7 @@ int get_data_and_calc(t_event *event,void *allineed) { i++; if(i%my_info.save_rate==0) { dc=DC_OK; - send_data(0); + send_data(120); dc=DC_QUIT; } if(i%my_info.s_rate==0) sputter(&d3_l); @@ -552,12 +574,15 @@ int get_data_and_calc(t_event *event,void *allineed) { /* finished */ dc=DC_END; - send_data(0); + send_data(121); dc=DC_QUIT; /* shutdown/free/close everything now ... */ free(d3_l.status); free(d3_l.extra); + free(c_profile); + free(n_e_loss); + free(nel_z); return 1; }