Click here to Skip to main content
15,891,248 members
Home / Discussions / Linux Programming
   

Linux Programming

 
GeneralRe: Reading Files on network box Pin
#realJSOP21-Dec-20 0:35
mve#realJSOP21-Dec-20 0:35 
QuestionGlade C++ Maximizing the window Pin
Member 1485117218-Jun-20 5:49
Member 1485117218-Jun-20 5:49 
Questionglade display an image Pin
Member 148511722-Jun-20 5:15
Member 148511722-Jun-20 5:15 
AnswerRe: glade display an image Pin
Richard MacCutchan2-Jun-20 5:26
mveRichard MacCutchan2-Jun-20 5:26 
QuestionMore advise wanted - how to run TWO loops ? Pin
Vaclav_13-Mar-20 15:23
Vaclav_13-Mar-20 15:23 
AnswerRe: More advise wanted - how to run TWO loops ? Pin
Peter_in_278013-Mar-20 18:31
professionalPeter_in_278013-Mar-20 18:31 
AnswerRe: More advise wanted - how to run TWO loops ? Pin
Richard MacCutchan13-Mar-20 23:09
mveRichard MacCutchan13-Mar-20 23:09 
AnswerRe: More advise wanted - how to run TWO loops ? Pin
Member 1477303714-Mar-20 20:42
Member 1477303714-Mar-20 20:42 
AnswerRe: More advise wanted - how to run TWO loops ? Pin
CPallini2-Apr-20 20:47
mveCPallini2-Apr-20 20:47 
GeneralSOLVED Re: More advise wanted - how to run TWO loops ? Pin
Vaclav_3-Apr-20 5:13
Vaclav_3-Apr-20 5:13 
GeneralRe: SOLVED Re: More advise wanted - how to run TWO loops ? Pin
CPallini3-Apr-20 5:42
mveCPallini3-Apr-20 5:42 
AnswerRe: More advise wanted - how to run TWO loops ? Pin
Member 1330167920-Dec-20 23:35
Member 1330167920-Dec-20 23:35 
QuestionSeeking professional advise... Pin
Vaclav_9-Mar-20 19:14
Vaclav_9-Mar-20 19:14 
AnswerRe: Seeking professional advise... Pin
k505410-Mar-20 4:29
mvek505410-Mar-20 4:29 
GeneralRe: Seeking professional advise... Pin
Vaclav_10-Mar-20 5:12
Vaclav_10-Mar-20 5:12 
GeneralRe: Seeking professional advise... Pin
Richard MacCutchan10-Mar-20 5:48
mveRichard MacCutchan10-Mar-20 5:48 
AnswerRe: Seeking professional advise... Pin
Joe Woodbury9-Jul-20 7:41
professionalJoe Woodbury9-Jul-20 7:41 
QuestionUsing bluetooth connection asynchronously - C++ Pin
Vaclav_7-Mar-20 8:49
Vaclav_7-Mar-20 8:49 
QuestionReturn indicates failure , errno indicates status? Pin
Vaclav_6-Mar-20 6:06
Vaclav_6-Mar-20 6:06 
AnswerRe: Return indicates failure , errno indicates status? Pin
k50546-Mar-20 6:34
mvek50546-Mar-20 6:34 
Both.

From the man page:

Quote:
RETURN VALUE
If the connection or binding succeeds, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS
The following are general socket errors only. There may be other domain-specific error codes.

EACCES For UNIX domain sockets, which are identified by pathname: Write permission is denied on the socket file, or
search permission is denied for one of the directories in the path prefix. (See also path_resolution(7).)

EACCES, EPERM
The user tried to connect to a broadcast address without having the socket broadcast flag enabled or the connec‐
tion request failed because of a local firewall rule.

EADDRINUSE
Local address is already in use.

... etc ...


So you know that the call to connect() did not succeed, because it returned -1. There's a lot of reasons that connect() might fail, and you can examine errno to find out why. In many cases, depending on context, an unsuccessful connect might be expected, or recoverable (e.g. if you've run out of resources, you might be able to either wait for other connections to close, or be able to clean up/close old connections). In your case errno is EINPROGRESS "The socket is nonblocking and the connection cannot be completed immediately". See the man page for further information. If this is a bluetooth, then consult any relevant bluetooth docs to see if EINPROGRESS is mentioned and why you might get that error code.

Note that perror() will always print "operation now in progress" any time errno == EINPROGRESS. Some library calls might set EINPROGRESS to indicate a condition that does not directly translate to "operation now in progress", but the resource is temporarily busy, and you should try again later, and EAGAIN already is used for some other retry condition.
GeneralRe: Return indicates failure , errno indicates status? Pin
Vaclav_6-Mar-20 8:18
Vaclav_6-Mar-20 8:18 
GeneralRe: Return indicates failure , errno indicates status? Pin
Richard MacCutchan6-Mar-20 21:42
mveRichard MacCutchan6-Mar-20 21:42 
GeneralRe: Return indicates failure , errno indicates status? Pin
k50547-Mar-20 4:55
mvek50547-Mar-20 4:55 
GeneralRe: Return indicates failure , errno indicates status? Pin
Vaclav_7-Mar-20 6:01
Vaclav_7-Mar-20 6:01 
GeneralRe: Return indicates failure , errno indicates status? Pin
Richard MacCutchan8-Mar-20 1:29
mveRichard MacCutchan8-Mar-20 1:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.