Commit 8955ad19 authored by agustin's avatar agustin
Browse files

ahora si loanterior

parent cafcbc69
......@@ -95,7 +95,9 @@ int main(){
cout << "Presione 1 para iniciar la reproduccion del video" << endl;
cin >> aux;
} while (aux != 1);
send(puertocTCP, (void *) &aux, sizeof(int), 0);
char* hola = new char;
*hola = 0;
send(puertocTCP, (void *) hola, 1, 0);
//viejo
......@@ -120,7 +122,7 @@ int main(){
//menu
bool reproduciendo = true;
bool pausado = false;
string opcion2;
char* opcion2;
int opcion = 1;
char const *msg;
int msg_size;
......@@ -140,42 +142,37 @@ int main(){
}
cout << "5 - Salir" << endl;
cin >> opcion2;
//primitiva SEND, retorna sent_msg..=-1 error o el numero bytes enviados
try{
opcion=stoi(opcion2);
}catch(invalid_argument e){
opcion = 0;
}
opcion=atoi(opcion2);
switch (opcion){
case 1:
msg = "1";
msg_size = strlen(msg);
send(puertocTCP, msg, msg_size, 0);
send(puertocTCP, msg, 1, 0);
reproduciendo = true;
pausado = false;
break;
case 2:
msg = "2";
msg_size = strlen(msg);
send(puertocTCP, msg, msg_size, 0);
send(puertocTCP, msg, 1, 0);
pausado = false;
break;
case 3:
msg = "3";
msg_size = strlen(msg);
send(puertocTCP, msg, msg_size, 0);
send(puertocTCP, msg,1, 0);
pausado = true;
break;
case 4:
msg = "4";
msg_size = strlen(msg);
send(puertocTCP, msg, msg_size, 0);
send(puertocTCP, msg, 1, 0);
reproduciendo = false;
break;
case 5:
msg = "5";
msg_size = strlen(msg);
send(puertocTCP, msg, msg_size, 0);
send(puertocTCP, msg, 1, 0);
pthread_cancel(hilo_stream);//problema 1
close(socket_de_clienteUDP);
break;
......
......@@ -161,11 +161,12 @@ void *controlVideo(void* pol){
int aux3=pthread_create(&hilo_stream, NULL, streamVideo,(void *)p);
cout<< "Hizo el thread stream"<< endl;
int aux = 1;
char *data = new char[1];
char *data_menu = new char;
while (aux!=5){
//primitiva RECEIVE
recv(p->pTCPcliente, (void *)data, 1, MSG_WAITALL);
aux = atoi(data);
recv(p->pTCPcliente, (void *)data_menu, 1, MSG_WAITALL);
cout << atoi(data_menu) << endl;
aux = atoi(data_menu);
switch (aux){
case 1:
cout<< "Apretaron 1"<< endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment