Subject: Lynx : unable to connect to remote host --error -possible fix
From: Saurabh Gupta <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Fri, 20 Jul 2001 23:13:49 -0400 (EDT)

I have a pentium III 550 MHZ
runing windows me : while trying to run lynx in
cygwin. I got an error 

Unable to Connect to Host :lynx.org and the program

terminated . This is inspite of the fact that 
my internet connection was fine and dandy
I spent a weekend tracing the bug and luckily found
it. Therefore this mail for all those facing the same 
problem and for the maintainers of the package to 
hopefully fix it in the standard distribution.
(specifically Corinna Vinschen of cygwin)
(i was told that u are maintaining it in cygwin).

Following is a piece of the log file generated from
lynx -tlog -trace
(the whole file was too long and irrelevant to post here)
(I also had to edit this portion a little bit because 
it had control characters and my email editor got confused)

start_curses: done.
HTParse: aName:`http://lynx.browser.org/'
   relatedName:`'
HTParse: (ABS)
HTParse:      result:http://lynx.browser.org/
Could not get ttyname or open UTMP file /etc/utmp
LYMain: User in REMOTE domain
Entering mainloop, startfile=http://lynx.browser.org/
getfile: getting http://lynx.browser.org/

HTParse: aName:`http://lynx.browser.org/'
   relatedName:`'
HTParse:      result:lynx.browser.org
CSS.CS:<status> (505)
CACHED: <status> @(21,0)
CSS:LYAttrset (0xffffffff, 0x40000)
CSS.CS:</status> (505)
CSS:LYAttrset (0, 0)
Getting http://lynx.browser.org/
HTParse: aName:`http://lynx.browser.org/'
   relatedName:`'
HTParse:      result:
Entered HTAnchor_findAddress
New anchor 0x14ae8a90 has hash 57 and address `http://lynx.browser.org/'
HTAccess: loading document http://lynx.browser.org/
HTParse: aName:`http://lynx.browser.org/'
   relatedName:`file:'
HTParse:      result:http
HTParse: aName:`http://lynx.browser.org/'
   relatedName:`'
HTParse:      result:lynx.browser.org
HTParse: aName:`http://lynx.browser.org/'
   relatedName:`'
HTParse:      result:http
HTParse: aName:`http://lynx.browser.org/'
   relatedName:`'
HTParse:      result:lynx.browser.org
CSS.CS:<status> (505)
CACHED: <status> @(21,0)
CSS:LYAttrset (0xffffffff, 0x40000)
CSS.CS:</status> (505)
CSS:LYAttrset (0, 0)
Looking up lynx.browser.org.Looking up lynx.browser.org.
HTParseInet: parsing `lynx.browser.org'.
LYGetHostByName: parsing `lynx.browser.org'.
End of LYGetHostByName: 0x6930d60 { h_name = 0x6930d80 "lynx.browser.org",
	 h_aliases = 0x6930d78 { 0x0 },
	 h_addrtype = 2, h_length = 4,
	 h_addr_list = 0x6930d70 { 0x6930d7c "195.40.122.44", 0x0 } }
LYGetHostByName: Resolved name to a hostent.
HTParseInet: Parsed address as port 80, IP address 195.40.122.44
CSS.CS:<status> (505)
CACHED: <status> @(21,0)
CSS:LYAttrset (0xffffffff, 0x40000)
CSS.CS:</status> (505)
CSS:LYAttrset (0, 0)
Making HTTP connection to lynx.browser.org.Making HTTP connection to lynx.browser.org.
TCP: Error 119 in `SOCKET_ERRNO' after call to this socket's first connect() failed.
	errno EINPROGRESS triggered
TCP: Error 119 in `SOCKET_ERRNO' after call to this socket's first select() failed.
	errno EINPROGRESS triggered
TCP: Error 22 in `SOCKET_ERRNO' after call to confirm-not-ready connect() failed.
	Invalid argument
HTTP: Unable to connect to remote host for `http://lynx.browser.org/' (errno = 22).

Alert!: Unable to connect to remote host.

CSS.CS:<alert> (3947)
CACHED: <alert> @(21,0)
CSS:LYAttrset (0xffffffff, 0x200000)
CSS.CS:</alert> (3947)
CSS:LYAttrset (0, 0)
Alert!: Unable to connect to remote host.HTAccess:  status=-29999
HTAccess: `http://lynx.browser.org/' has been accessed, No data loaded.

stop_curses: done.

Looking up lynx.browser.org.
Making HTTP connection to lynx.browser.org.
Alert!: Unable to connect to remote host.

lynx: Can't access startfile http://lynx.browser.org/

----end log file ------------------

after spending hours tracking the bug I found that the 
following change in the source file HTTCP.c in the dirctory
/usr/src/lynx2-8-3/WWW/Library/Implementation
OR
<whatever path>/lynx2-8-3/WWW/Library/Implementation/HTTCP.c
and compiling fixed the problem.
Following is the piece of HTTCP.c file that i changed.

   1594
   1595 #ifdef _WINDOWS_NSL
   1596             timeout.tv_sec = 100;
   1597 #else
   1598             timeout.tv_sec = 0;
   1599 #endif /* _WINDOWS_NSL */

/* line 1600 below read like:  
		    timeout.tv_usec = 100000;
before I fixed it. I just increased the timeout
value from 100000 micro second to 900000 microsecond 
*/

   1600             timeout.tv_usec = 900000;
   1601             FD_ZERO(&writefds);
   1602             FD_SET((unsigned) *s, &writefds);

Hope this helps 
Let me know if somebody wants me to send a diff patch
also send me the instructions on how to create it 
I am too lazy to find it out and dont exactly remember
it
Feel free to write to me with any questions.
Saurabh Gupta
[email-masked]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/