The problem is that you sent the structure (message1
) instead of the encoded buffer.
Change the last part of the C program to:
if( send( to_server_socket, buffer, bufferLen, 0 ) != bufferLen ) {
printf( "socket write failed");
exit( -1 );
}
Expect something like a sequence of the following bytes (hexa) 30 03 02 01 02