lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV lynx386 problem "alert: socket failed"


From: Hasan Karahasan
Subject: LYNX-DEV lynx386 problem "alert: socket failed"
Date: 18 Nov 1997 17:23:00 +0100

The following applies to all versions of lynx386 reguardless of its version
number and to all users of lynx386 I have asked here in Germany.

I'm really wondering why no one has reported this bug yet. Maybe you
haven't noticed it, so try the following.

Start lynx386 and follow 21 links from the net (not to a local file). Now
follow the 22th link. You should get the message "alert: socket failed" etc...
Once this has happened you cannot follow a link anymore. You can navigate
through the pages in the cache and you also can call a link to a local file,
but you cannot call a page from the net. The communication between lynx and
the tcp-socket seems to be corrupted. You have to quit lynx and to restart it
again. By this you reinitialize the communication and it works again for 21
links that can be called through the net. It is not necessary to disconnect
the phone line.

So I spent some time last weekend to find out what's happening there. Okay, I
first have to appologize, but I am absolutely not familiar with tcp or network
programming. So the changes I suggest here may seem very bad. What I have done
is not a real solution, but more or less a work around to take the sting out
of this bug. I would appreciate to see a better solution from someone else.
Here is what I have done. It maybe difficult to understand and to follow my
minds reading this lines in a view seconds. I needed two days to see the
dependencies in the code, but please try it.

1. I have tried to find where in the source this message is called and at
which condition this happens. I found it in
www\library\implemen\httcp.c line 760 to 767.
--------------------------------------
    **  Now, let's get a socket set up from the server for the data.
    */
    *s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (*s == -1) {
        HTAlert("socket failed.");
        FREE(line);
        return HT_NO_DATA;
    }
----------------------------------------
Okay I have inserted a printf("%d", *s); to see what's happening. *s is
incremented by one each time you make a http-request. *s is = 10 at the first
http-request after starting lynx. This is incremented until 31. The next is
not 32 but -1. And here we have the condition for the message.

2. Since this function call
*s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
is not a lynx function. It comes from the wattcp-library. Hence we shouldn't
change anything here to avoid problems for non-dos-os. So I started searching
for this function in the tcp helper files.

3. Let's edit \lynx2-7-\djgpp\tcplib\tcpsys\socket.c line 68-77.
--------------------------------------------------
/* I used 10, so that applications can assume FIRSTSOCK=10 (Though they
   shouldn't...... (i.e. for future expansion.) You are welcome to change
   it. Currently only sockets 0 are used for a devices (the console(0) and for
   BOOTP and Domain name servers (1)). */
#define FIRSTSOCK 10
/*
 Socket 0 = Console
 Socket 1 = System Socket (For Bootp, Domain name servers,....)
 Add Socket descriptions here if you modify the code.
 */
--------------------------------------------------------
Okay, this is the reason why *s is = 10 at the first http-request. I have
changed FIRSTSOCK to 3.

4. Let's edit \lynx2-7-\djgpp\tcplib\include\tcp\osdep.h lines 7-15.
----------------------------
#ifndef OPEN_MAX
#define OPEN_MAX 32
----------------------------------
This limits the number of possible http requests to 32 - FIRSTSOCK = 21.
Who can explain me why this is necessary? I have changed OPEN_MAX to 128. So
the number of possible http requests increases to 125 (OPEN_MAX - FIRSTSOCK).
This is not good, but it is better than 21 requests, and should be enough for
a little surfing in the net at the evening.
----------------------------------------------
#endif
#if OPEN_MAX <= 128
#define MAXSOCKS (OPEN_MAX - 1)
#else
#define MAXSOCKS 128
#endif

Don't forget to recompile the tcp library. I could not find any other bugs
that may be caused by these changes so far.

Hasan
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]