Failed to get remote IP Address #1046
-
I tried to get the remote IP address by using ws->getRemoteAddress(), while some garbled codes ( just like ▒▒▒O) was printed. How can i get the IP address correctly? Thanks~ |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
It is binary |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. The error message shows the return value of getRemoteAddress() is class std::basic_string_view,so what do you mean it is binary?How can I convert its return value to string. I have tried some methods but failed. I'm new in C++17... |
Beta Was this translation helpful? Give feedback.
-
IPv4 is 4 bytes IPv6 is 16 bytes. These are the bytes given. "127.0.0.1" is {127, 0, 0, 1} |
Beta Was this translation helpful? Give feedback.
IPv4 is 4 bytes IPv6 is 16 bytes. These are the bytes given.
"127.0.0.1" is {127, 0, 0, 1}