Ho scritto un'applicazione in c++ che permette di inviare pacchetti da una porta (dove è attaccato un device rfid) e l'ethernet.
L'applicazione scritta su 64bit mi funziona ma per motivi di tesi devo portarla su un pc a 32 bit. La parte di codice che mi dà fastidio è la seguente:
while(1) {
try {
length_receive=recvfrom(par->sock2.fd, buffer,BUFFER_LENGTH,0,
(struct sockaddr*)par->address2.address,
&par->address2.address_length);
if(length_receive==-1) {throw RecvfromException ();}
} catch (RecvfromException e) {e.getDescription ();}
std::cout <<"Ricevuto il pacchetto dall'interfaccia'\n"<<std::endl;
IPv6Packet packet=IPv6Packet (buffer,length_receive);
packet.printInEx (' ');
std::cout <<"Lunghezza:"<< length_receive << std::endl;
try {
length_send=sendto(par->sock1.fd, buffer,length_receive,0,
(const struct sockaddr*)par->address1.address,
par->address1.address_length);
if(length_send==-1) {throw SendToException ();}
} catch(SendToException e) {e.getDescription ();}
std::cout << "Rispedito al sunspot\n"<<std::endl;
[\code]
una volta che parte la prima recvfrom, il while gira e incomincia a inviare pacchetti che non sono inviati. È come se il buffer invia i pacchetti precedenti insieme a quello nuovo. Questo solo nella 32bit. È un problema di compilatore? Come posso risovlvere?
|