Operating System - HP-UX
1834305 Members
2647 Online
110066 Solutions
New Discussion

Re: Errno of Non-blocking connect()

 
Sung-hee Kim
Occasional Contributor

Errno of Non-blocking connect()

Non-blocking connect() is valid when return value is 0 or return valud is -1 and errno is EINPROGRESS.

I made a program which connect to web server. When it run WITHOUT thread, non-blocking connect()'s errno
is EINPROGRESS. But WITH threads, errno is ECHILD or ENOENT.

All threads of a process is shared a errno. So,
I tried to lock connect() function. But the result is same. The program is running well in Linux.

Thank you in advance,

Sunghee Kim
2 REPLIES 2
Mike Stroyan
Honored Contributor

Re: Errno of Non-blocking connect()

Threads should not be sharing an errno. The errno value is context switched with 10.20 libcma threads. The errno value is accessed through a function macro and thread specific data with 11.x and libpthread. Perhaps your program is missing the necessary header files or compilation options. See "man pthread" or the documents under this URL for details of how to build threaded programs.
http://h21007.www2.hp.com/dspp/topic/topic_PETechnologyDetailPage_IDX/1,2603,10318,00.html
Adam J Markiewicz
Trusted Contributor

Re: Errno of Non-blocking connect()

I had simmilar problem. Non-blocking connect returned -1 and errno was not EINPROGRESS. When I ignored it I've discovered that after some time correct connection was establised anyway.

Best regards

Adam
I do everything perfectly, except from my mistakes