| 
 Hi Thomas, 
In my application I need to retrieve the IP address 
of the peer host to which there is an existing connection identified by the 
socket number. As far as I know there is a function in a kernel implementation 
of TCP, which can accomplish this: getpeername(). The version of this function 
in the socketapi is: ext_getpeername(). 
Thus, I call this function as follows: 
ext_getpeername(socket_number, 
(struct sockaddr *) &saddr, (socklen_t 
*) sizeof((struct sockaddr) saddr)); 
where 
socket_number - the socket 
descriptor of the SCTP association 
saddr - a structure of type 
sockaddr_in 
But, as a result of the execution of the function, I get 
segmentation fault (core dumped). 
Where do I make the mistake? Is there another way of finding 
out the peer host name or IP address by only knowing the socket 
number. 
Best regards, 
Marjan 
 | 
Archive powered by MHonArc 2.6.19+.