?
=?iso-8859-1?q?Fredrik_H=E5kansson?=
Hello!
I'm a beginner and are struggling to learn.
I'm on Linux and i know that i have an IP address in the member
variable RealHostAddr.sin.sin_addr.s_addr in HEX format. However i'm not
sure if this is a char[], long or what it is.
I have tried to have the contents of RealHostAddr.sin.sin_addr.s_addr to
be put into syslog.
I have tried the following:
syslog(LOG_DEBUG,"%s",(char *)RealHostAddr.sin.sin_addr.s_addr);
and
syslog(LOG_DEBUG,"%s",(char *)RealHostAddr.sin.sin_addr.s_addr, 10);
and
syslog(LOG_DEBUG,"%d",(int)RealHostAddr.sin.sin_addr.s_addr, 10);
and
syslog(LOG_DEBUG,"%d",(long)RealHostAddr.sin.sin_addr.s_addr, 10);
And many other but nothing seems to work. I have reasons to believe that
the IP is stored backwards so that 192.168.20.50 is 50.20.168.192. So i
also later want to use ntohl().
Fredrik
I'm a beginner and are struggling to learn.
I'm on Linux and i know that i have an IP address in the member
variable RealHostAddr.sin.sin_addr.s_addr in HEX format. However i'm not
sure if this is a char[], long or what it is.
I have tried to have the contents of RealHostAddr.sin.sin_addr.s_addr to
be put into syslog.
I have tried the following:
syslog(LOG_DEBUG,"%s",(char *)RealHostAddr.sin.sin_addr.s_addr);
and
syslog(LOG_DEBUG,"%s",(char *)RealHostAddr.sin.sin_addr.s_addr, 10);
and
syslog(LOG_DEBUG,"%d",(int)RealHostAddr.sin.sin_addr.s_addr, 10);
and
syslog(LOG_DEBUG,"%d",(long)RealHostAddr.sin.sin_addr.s_addr, 10);
And many other but nothing seems to work. I have reasons to believe that
the IP is stored backwards so that 192.168.20.50 is 50.20.168.192. So i
also later want to use ntohl().
Fredrik