packet.append(0xBF)
packet.append(0xAB)
packet.append(0xCD)
packet.append(0xEF)
Well since these aren't printable characters, what were you expecting?

Instead of
Code:
printf("%s",msg);
Code:
char *p = msg;
while ( *p ) {
  printf("%x\n", *p++);
}
Do you see the raw bytes you sent?