Index: trunk/absroot/source/absc/test/Control_Module_Client/.cproject
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/.cproject b/trunk/absroot/source/absc/test/Control_Module_Client/.cproject
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/.cproject (revision 32)
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/absroot/source/absc/test/Control_Module_Client/.project
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/.project b/trunk/absroot/source/absc/test/Control_Module_Client/.project
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/.project (revision 32)
@@ -0,0 +1,81 @@
+
+
+ Control_Module_Test
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+ ?name?
+
+
+
+ org.eclipse.cdt.make.core.append_environment
+ true
+
+
+ org.eclipse.cdt.make.core.autoBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.buildArguments
+
+
+
+ org.eclipse.cdt.make.core.buildCommand
+ make
+
+
+ org.eclipse.cdt.make.core.buildLocation
+ ${workspace_loc:/Control_Module_Test/Release}
+
+
+ org.eclipse.cdt.make.core.cleanBuildTarget
+ clean
+
+
+ org.eclipse.cdt.make.core.contents
+ org.eclipse.cdt.make.core.activeConfigSettings
+
+
+ org.eclipse.cdt.make.core.enableAutoBuild
+ false
+
+
+ org.eclipse.cdt.make.core.enableCleanBuild
+ true
+
+
+ org.eclipse.cdt.make.core.enableFullBuild
+ true
+
+
+ org.eclipse.cdt.make.core.fullBuildTarget
+ all
+
+
+ org.eclipse.cdt.make.core.stopOnError
+ true
+
+
+ org.eclipse.cdt.make.core.useDefaultBuildCmd
+ true
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.cnature
+
+
Index: trunk/absroot/source/absc/test/Control_Module_Client/ClienteUDP.c
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/ClienteUDP.c b/trunk/absroot/source/absc/test/Control_Module_Client/ClienteUDP.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/ClienteUDP.c (revision 32)
@@ -0,0 +1,83 @@
+/*
+ * ClienteUDP.c
+ *
+ * Fecha de creacion : Nov 2, 2009
+ * Ultima modificacion : Nov 19, 2009
+ * Autor : Jose Francisco Quenta C.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "./Librerias/Mensajes.h"
+
+#define PUERTO_SERVIDOR 5500
+//#define DIR_SERVIDOR "10.10.12.255"
+#define DIR_SERVIDOR "192.168.1.255"
+
+int ClienteUDP(char *opcion, char *valor){
+
+ int conexion_clienteFD;
+ struct sockaddr_in inf_servidor;
+
+ int broadcast= 1;
+ int resultado;
+ int numbytes_enviados;
+
+ char *buff_peticion;
+ char *comando= NULL;
+
+ if (strcmp(opcion,"-l") == 0){ // Se reconoce el comando que se esta enviando
+ comando= "CARGA:";
+ }else if(strcmp(opcion,"-c") == 0){
+ comando= "CAMBIA:";
+ }else if(strcmp(opcion,"-ch") == 0){
+ comando= "CHEQUEO:";
+ }else {
+ ERROR("OPCION INCORRECTA: {-l|-c|-ch}");
+ return -1;
+ }
+
+ buff_peticion= (char *) malloc(strlen(comando)+1+strlen(valor)+1); // Se arma el buffer a ser enviado.
+ strcpy(buff_peticion,comando);
+ strcat(buff_peticion,valor);
+
+ /* Se establece el socket UDP */
+ conexion_clienteFD= socket(AF_INET,SOCK_DGRAM,0);
+ if (conexion_clienteFD == -1){
+ ERROR("No se pudo establecer el socket: socket()");
+ return -1;
+ }
+
+ /* Se establece el Broadcast con la funcion setsockpt() */
+ resultado= setsockopt(conexion_clienteFD, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast));
+ if (resultado == -1){
+ ERROR("No se pudo establecer la opcion de Broadcast: setsockopt()");
+ return -1;
+ }
+
+ /* Se configura la estructura que contiene la informacion sobre el servidor: inf_servidor */
+ inf_servidor.sin_family= AF_INET;
+ inf_servidor.sin_port= htons(PUERTO_SERVIDOR);
+ inf_servidor.sin_addr.s_addr= inet_addr(DIR_SERVIDOR);
+ memset(inf_servidor.sin_zero, '\0', sizeof(inf_servidor.sin_zero));
+
+ /* Se procede a enviar el buffer */
+ numbytes_enviados= sendto(conexion_clienteFD,buff_peticion,strlen(buff_peticion),0,(struct sockaddr *)&inf_servidor,sizeof(inf_servidor));
+ if(numbytes_enviados == -1){
+ ERROR("Error de envio de datos: sendto()");
+ return -1;
+ }
+
+ close(conexion_clienteFD);
+
+ return 0;
+}
Index: trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Funciones_ControlER.h
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Funciones_ControlER.h b/trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Funciones_ControlER.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Funciones_ControlER.h (revision 32)
@@ -0,0 +1,19 @@
+/*
+ * Funciones_ControlERs.h
+ *
+ * Created on: Jan 14, 2010
+ * Author: redes
+ */
+
+#ifndef FUNCIONES_CONTROLERS_H_
+#define FUNCIONES_CONTROLERS_H_
+
+int estado_ERemota(char dir_red[],int dir_inicio,int dir_fin);
+
+int envia_experimento(char valor[], int base);
+
+int trae_monitoreo(char valor[], int base);
+
+int ClienteUDP(char *opcion, char *valor);
+
+#endif /* FUNCIONES_CONTROLERS_H_ */
Index: trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Mensajes.h
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Mensajes.h b/trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Mensajes.h
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/Librerias/Mensajes.h (revision 32)
@@ -0,0 +1,17 @@
+/*
+ * Mensajes.h
+ *
+ * Created on: Nov 12, 2009
+ * Author: redes
+ */
+
+#ifndef MENSAJES_H_
+#define MENSAJES_H_
+
+void LOG_SERVIDOR(char *mensaje);
+void LOG_CLIENTE(char *mensaje);
+void ERROR_FATAL(char *mensaje);
+void ERROR(char *mensaje);
+
+
+#endif /* MENSAJES_H_ */
Index: trunk/absroot/source/absc/test/Control_Module_Client/Mensajes.c
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/Mensajes.c b/trunk/absroot/source/absc/test/Control_Module_Client/Mensajes.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/Mensajes.c (revision 32)
@@ -0,0 +1,39 @@
+/*
+ * Mensajes.c
+ *
+ * Created on: Nov 12, 2009
+ * Author: Jose Francisco Quenta
+ */
+
+#include
+#include
+
+/*
+ * Imprime mensajes del servidor
+ */
+void LOG_SERVIDOR(char *mensaje){
+ printf("SERVIDOR: %s\n",mensaje);
+}
+
+/*
+ * Imprime mensajes del cliente
+ */
+void LOG_CLIENTE(char *mensaje){
+ printf("CLIENTE: %s\n",mensaje);
+}
+
+/*
+ * Error no fatal, permite la continuación del programa
+ */
+void ERROR(char *mensaje){
+ fprintf(stderr, "ERROR. %s\n", mensaje);
+}
+
+/*
+ * Error fatal, aborta la ejecución del programa con código de salida de error
+ */
+void ERROR_FATAL(char *mensaje){
+ fprintf(stderr, "ERROR FATAL. %s\n", mensaje);
+ exit(EXIT_FAILURE);
+}
+
Index: trunk/absroot/source/absc/test/Control_Module_Client/Prueba_ClienteUDP.c
===================================================================
diff --git a/trunk/absroot/source/absc/test/Control_Module_Client/Prueba_ClienteUDP.c b/trunk/absroot/source/absc/test/Control_Module_Client/Prueba_ClienteUDP.c
new file mode 10644
--- /dev/null (revision 0)
+++ b/trunk/absroot/source/absc/test/Control_Module_Client/Prueba_ClienteUDP.c (revision 32)
@@ -0,0 +1,19 @@
+/*
+ * Prueba_UDP.c
+ *
+ * Created on: Nov 19, 2009
+ * Author: redes
+ */
+
+#include
+#include
+
+#include "./Librerias/Mensajes.h"
+#include "./Librerias/Funciones_ControlER.h"
+
+int main(int argc, char *argv[]){
+
+ ClienteUDP(argv[1],argv[2]);
+
+ return 0;
+}