c - Sending 2 bytes hexadecimal to a remote serial -
i need send hexadecimal remote serial device accept it.
2 byte hexadecimal need send is:
181e i can telnet remote serial , send command:
telnet x.x.x.x port 181e i response okay.
how can in linux c?
i want use write function.
err = write(socket,181e,2); or how can store 2 byte decimal variable read 181e?
int this_is_2_bytes = 181e; // correct? err = write(socket, this_is_2_bytes, sizeof(this_is_2_bytes));
you need send hexadecimal string. so,
const char cmd[] = "181e"; err = write(socket, cmd, strlen(cmd));
Comments
Post a Comment