Zitat von Michael Bell <[email protected]>: > I use the following code to initialize an OBEX server. > > size_t size = sizeof(struct sockaddr_in); > struct sockaddr_in *addr = smlTryMalloc0(size, error); > if (!addr) > goto error; > addr->sin_family = PF_INET; > addr->sin_port = htons(env->port); > addr->sin_addr.s_addr = INADDR_ANY; > /* register server */ > if (GET_OBEX_RESULT(TcpOBEX_ServerRegister(env->handle, (struct sockaddr > *) addr, size)) < 0) > ... > > OBEX_Init is called earlier with OBEX_TRANS_INET. My problem is that > Valgrind reports that there is a problem with bind. So my question is, > what must be changed in my code to use libopenobex in the right way?
Nothing. You could use an IN6ADDR_ANY with PF_INET6 as yours is automatically transformed to that. > I have no idea why libopenobex do IPv6 stuff with my IPv4 address. OpenOBEX uses an IPv6 socket internally. All current versions of the supported systems (Windows, Linux, *BSD) have dual-IP stacks, thus can also handle IPv4 on IPv6 sockets. > The code itself works. Valgrind only reports a read of unitialised bytes. I could initialize it but there is no real gain (except that valgrind doesn't complain anymore): scope_id is only used on link-local IPv6 addresses (and site-local ones when doing multicast which doesn't matter here). So having it non-initialized on an ANY address is not really a bug, rather that bind() accesses it under these conditions. OTOH, maybe it's just doing a copy of the whole thing. If you want to initialize it anyway: lib/inobex.c, function inobex_prepare_connect(). ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Openobex-users mailing list [email protected] http://lists.sourceforge.net/lists/listinfo/openobex-users
