Re: Trouble with "Web server and client"
- Posted by gertie at ad-tek.net Aug 01, 2001
- 418 views
On 1 Aug 2001, at 22:10, Ted Fines wrote: > > I am having some trouble with Pete Eberlein's "Web server and client" for > Linux (http://www.rapideuphoria.com/webutils.zip). > > Since the code is just socket communications, it need not be used only for web > access. Just change the port to 21 for telnet, 143 for imap, etc., and you > should be able to communicate, right? > > That's what I thought, but I've run into a stumbling block. > > Take a look at Pete's sample code, which works fine: > data = allocate(1) > while 1 = c_func(read, {i, data, 1}) do > reply &= peek(data) > end while > free(data) > > Now take a look at mine, which gets stuck for some reason: > data=allocate(1) > while 1 = c_func(read, {session, data, 1}) do > reply &= peek(data) > end while > free(data) > > So I put in a couple lines to see what it being read: > puts(1,sprintf("%s:%d-",{reply[length(reply)], > reply[length(reply)]})) > > I am running this with trace on, by the way. In both cases, the last > characters read are a 13 then a 10. But with Pete's code, the while loop > gets exited, while with mine, it just gets stuck; the cursor stays on the > 'end while' line and won't budge. In the trace window, are you hitting <enter> or <arrow down> to step thru the program? Kat > I am accessing Port 143 (IMAP), as opposed to 80 (http), but other than > that, there isn't any difference. > > Can anyone see what I'm doing wrong? I just don't see why my code hangs on > the > while loop. He has i declared as an integer, and data as an atom, while have > session as an integer, and data as an atom. Any ideas? > > Thanks, > Ted Fines > Macalester College > > > > > >