I'm working with sockets, but when I compile my program I get some errors.
This is my code:
address.sin_family = AF_INET;
address.sin_port = htons(string); // here I get an error
inet_aton(str.c_str(),&address.sin_addr);
What I get is:
cannot convert ‘__gnu_cxx::__alloc_traits > >::value_type {aka std::__cxx11::basic_string}’ to ‘uint16_t {aka short unsigned int}’ for argument ‘1’ to ‘uint16_t htons(uint16_t)’
How can I solve this error?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire