Monday, August 02, 2004

RD-XS53/XS43 : Some Japanese developers are analyzing the recorders to get the recorded MPEG files to PC. It seems that the recorders use NetBIOS to find other recorders to transport the recorded files, and the transfer is executed using FTP. I like the recorders because it has two tuner board and a connector for satellite broadcasting devices. I might buy the recorders if Toshiba will support UPnP AV.

KURO-BOX : To compile CyberLink for C++, I changed the Vector::get() not to use stl::vector::at() as the following because the old gcc compiler, v2.95.3, doesn't support the method. I had to add some headers such as <stdio.h> and <typeinfo> to compile normally.
void *Vector::get(int index)

{
if (index < 0)
return NULL;
if ((int)size() < (index+1))
return NULL;
//return (void *)at(index);
return (void *)((*this)[index]);
}
net-tools : The Linux box has no <ifaddrs.h> to get the local host interfaces. Then, I have to create the same function using ioctl based on the ifconfig source codes as the following. The latest package, v1.60, uses some GNU original functions such as getdelim(), and I checked the v1.46.
static const char *PATH_PROC_NET_DEV = "/proc/net/dev";


int CyberNet::GetHostAddresses(NetworkInterfaceList &netfiList)
{
netfiList.clear();
int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
return 0;
FILE *fd = fopen(PATH_PROC_NET_DEV, "r");
char buffer[256+1];
fgets(buffer, sizeof(buffer)-1, fd);
fgets(buffer, sizeof(buffer)-1, fd);
while (!feof(fd)) {
char *ifname = buffer;
char *sep;
if (fgets(buffer, sizeof(buffer)-1, fd) == NULL)
break;
sep = strrchr(buffer, ':');
if (sep)
*sep = 0;
while (*ifname == ' ')
ifname++;
struct ifreq req;
strcpy(req.ifr_name, ifname);
if (ioctl(s, SIOCGIFFLAGS, &req) < 0)
continue;
if (!(req.ifr_flags & IFF_UP))
continue;
if (req.ifr_flags & IFF_LOOPBACK)
continue;
if (ioctl(s, SIOCGIFADDR, &req) < 0)
continue;
char ifaddr[20+1];
strncpy(ifaddr, inet_ntoa(((struct sockaddr_in*)&req.ifr_addr)->sin_addr), sizeof(ifaddr)-1);
NetworkInterface *netIf = new NetworkInterface(ifaddr, ifname, 0);
netfiList.add(netIf);
}
fclose(fd);
close(s);
return netfiList.size();
}

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?