hello guys,
i am trying to translate a little code from C to java, but i cant..
please help me..
the first part is:
and the second part is :struct tPacket { WORD size; WORD opcode; BYTE securityCount; BYTE securityCRC; BYTE data[8186]; }; // A genrel Packet struct tPacket_5000_E { WORD size; WORD opcode; BYTE securityCount; BYTE securityCRC; BYTE flag; BYTE blowfish[8]; DWORD seedCount; DWORD seedCRC; DWORD seedSecurity[5]; }; struct tPacket_5000_10 { WORD size; WORD opcode; BYTE securityCount; BYTE securityCRC; BYTE flag; DWORD challenge[2]; };
please help me guys :Sint rcv = 0; tPacket Packet; do { recv(Socket, (char *)Packet, sizeof(Packet), 0); if (rcv > 0) { if (Packet.opcode == 0x5000 && Packet.size == 0x25) std::cout << "First Packet received"; else if (Packet.opcode == 0x5000 && Packet.size == 0x09) std::cout << "Second Packet received"; else if (Packet.opcode != 0x5000) { pritnf("%.4X %.4X %.2X %.2X", Packet.size, Packet.opcode, Packet.securityCount, Packet.securityCRC); for(int i = 0; i < Packet.size; i++) { printf("%.2X", Packet.data[i]); } } } while(rcv != SOCKET_ERROR);
thx a lot.