From the socket server, I send the character whose ASCII code is 65 (A).

s.sendall(chr(65).encode("utf-8")) 

A client written in C accepts this symbol.

 char buf[10]; recv(sock, buf, sizeof(buf) , 0); 

How can I display the ASCII character code on the client?

  • one
    printf("%d", buf[0]); - avp pm
  • chr(65).encode("utf-8") is at least redundant .. print: `printf ("% c - 0x% x ", buf [0], buf [0]); - NewView pm
  • @avp why is -60 displayed for character 256? - rootkit.sys pm
  • Character code 256 in ASCII is missing. ASCII characters have codes from 0 to 255. - freim
  • @freim why then the character 250 is displayed as -61? - rootkit.sys

0