LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-07-2015, 01:48 PM   #1
tilman1
Member
 
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72

Rep: Reputation: 15
connect fails, errno is 0 however


Dear all

though not strictly a kernel problem, I would think that this is the most suitable group. If not, please let me know, and I will post it to a different group.

I am debugging a c++ program on an embedded arm system (linux kernel 3.17.4) that is showing a funny behaviour.

In a method, a network socket is opened as non-blocking and then connected to a server. On the server side, I can see that the connection request is always successful. On the client side, the connect routine however sometimes returns with -1, while the error code (errno) is 0.

Within the program (daemon), the behaviour is reproducible,i.e. depending on the context from which the method running the connect routine is called, connect returns -1 or 0. I can however not isolate it, i.e. write a small program that reproduces the behaviour.

Any thoughts on that ? Maybe a race condition ? Is connect/errno reentrandant-safe?


Thanks
Tilman

but I cannot isolate it. (write a small program that always shows it). It could be dependent on the caller.

The program is written in C++ (not sure if it


fcntl(fd, F_SETFL, O_NONBLOCK)
result = ::connect(fd, (struct sockaddr *)&saddr, sizeof(saddr));
 
Old 11-07-2015, 03:01 PM   #2
tilman1
Member
 
Registered: Mar 2007
Location: Stuttgart, Germany
Distribution: gentoo
Posts: 72

Original Poster
Rep: Reputation: 15
Hello all

apparently, errno is reentrant-safe -- at least this is what the man page says.

Regards

Tilman
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [Errno 14] PYCURL ERROR 7 - "couldn't connect to host" Trying other mirror user1989 Linux - Networking 6 01-21-2016 10:31 AM
[SOLVED] wifi fails to connect nnjond Linux - Networking 1 11-13-2012 04:06 AM
[SOLVED] ErrNo 14 and ErrNo 256 in yum server configuration nivedhitha Linux - Server 4 05-22-2011 12:45 AM
TCP CONNECT fails wiener Linux - Networking 1 10-24-2009 05:28 AM
internet fails to connect jagguy Linux - Wireless Networking 22 06-19-2007 02:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration