我试图编码一个int并将其发送到java服务器。这是我在客户端上的C代码
int clientNumber;
printf("Enter a number :\n ");
scanf("%d",&clientNumber);
Message01_t *a;
a->number = clientNumber;
der_encode(&asn_DEF_Message01, a, 1, 0);
if( send( to_server_socket, &a, sizeof( a), 0 ) != sizeof( a ) )
{
printf( "socket write failed");
exit( -1 );
}
这是java代码
BerInputStream bin = receive(5);
Message01 msg01 = new Message01();
msg01.decode(bin);
printMessage(msg01);
但我总是记下服务器上的号码42!