mucha
November 28th, 2006, 02:46 AM
Hi, I've just started with c++ for real. And I'm now trying some socketprogramming.
In a function I got this:
struct sockaddr their_addr;
this->sockfd = accept(*sockfd, &their_addr, addrlen);
cout << their_addr.sin_addr << endl;
I want to get the host of the one that is connecting.
When I compile it I get these errors:
httpconn.cpp: In member function ‘bool HttpConn::approve(int*, socklen_t*)’:
httpconn.cpp:14: error: ‘struct sockaddr’ has no member named ‘sin_addr’
Feels I've tried everything, please help :)
In a function I got this:
struct sockaddr their_addr;
this->sockfd = accept(*sockfd, &their_addr, addrlen);
cout << their_addr.sin_addr << endl;
I want to get the host of the one that is connecting.
When I compile it I get these errors:
httpconn.cpp: In member function ‘bool HttpConn::approve(int*, socklen_t*)’:
httpconn.cpp:14: error: ‘struct sockaddr’ has no member named ‘sin_addr’
Feels I've tried everything, please help :)