I'm basically using a stringstream to obtain the value converted and then convert it to a string, then to a System::String (String^), to set the String^ as text of a label, like this:
stringstream s; s << "..."; string ss = s.str(); String^ sss = gcnew String(ss.c_str()); titlelabel->Text = L"" + sss;
The problem is the value "..." . I've tried doing:
s << inet_ntoa(client.sin_addr.s_addr);
but then I get
error C2664: 'inet_ntoa': cannot convert parameter 1 from 'ULONG' to 'in_addr'
If I take away the .s_addr, I get it to run, but the IP address that comes out is 184.108.40.206 or 220.127.116.11 or 244.234.69.0 or other values EXCEPT my IPv4, which starts with 192.
If I convert like this:
char buf[INET_ADDRSTRLEN] = ""; s << inet_ntop(AF_INET, &client.sin_addr.s_addr, buf, sizeof buf);
I still get anything except my ipv4. And if I take away the .s_addr, I still don't get the ipv4
So how should I convert? Or this is method of getting the IP address even correct? What do you suggest I should do, that's easy to understand given my low level in network programming (ESPECIALLY in c++)
Please let me know. And as always, thanks for any help or suggestion