connect() fails?

Luciano Rocha strange at nsk.no-ip.org
Mon Oct 22 13:46:35 UTC 2007


On Mon, Oct 22, 2007 at 12:21:20PM +0000, Daniel Ng wrote:
> Hi,
> 
> I'm using uClibc 0.9.28 in a buildroot environment.
> 
> I'm having trouble connecting to a TCP socket. connect() returns -1 with errno 
> set to '1' which from looking at the errno include files translates 
> to 'EPERM'. 
> 
> According to the man page for connect(), this means I was trying to either 
> connect to a broadcast address, or connect() was being blocked by a local 
> firewall rule. I know I'm not using a broadcast address (it's 127.0.0.1), and 
> I have no firewalls on my embedded platform. I can connect to the telnet 
> server using the standard linux telnet client. Changing the FD flags makes no 
> difference.
> 
> Any suggestions would be most helpful, short of upgrading uClibc.
> 
<snip>
>   if ( (error = getaddrinfo(hostname, service, &hints, &res)) != 0 ) 

You're searching for hostname and service in the same call to
getaddrinfo. Last time I tried that, the service was ignored, and I
switched to using two calls, one for the host and another for the
service.

See if the output has all the values correct (sin_addr.s_addr and
sin_port).

-- 
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20071022/18ed7c71/attachment-0002.pgp 


More information about the uClibc mailing list