Re: webserver

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 8 Feb 2002, at 8:43, Thomas Parslow (PatRat) wrote:

> 
> > No one is using Srvsckip.ew? What lib do you prefer for async internet
> > access?
> 
> > But ok, lemme rephrase the previous question, in using Eu to serve 
> > webpages, what is the way one would get the ip# of the connecting client?
> > Since i am one person, with no assistance in any coding, and don't want to
> > open the firewall to a bouncer, all i get is 127.0.0.1 now. I am using
> > WsockGetSockName(Socket) in Srvsckip.ew, which calls some c_func i don't
> > understand yet. Am i doing this right?
> 
> Yup, just tried it out and:
> 
> sequence ip
> ip = WsockGetSockName(Socket)
> 
> Will get the IP address of the foreign host as a string (4 octet doted
> format).

Cool, i was using that! But when i ask for the port number, i keep getting 
only port 47, that's not in the temp port range IE usually uses. What's with 
that?

> > And i noticed IE doesn't drop the connection, it uses Keep Alive, so how do
> > i
> > force the socket closed at my end once the page is sent? cCloseSocket =
> > define_c_proc(Winsock, "closesocket",{C_INT}) in Srvsckip.ew doesn't seem to
> > do it. And how do i know the client read the page i stuffed into the socket?
> > Cause if i close it before it's read, the client doesn't get it.
> 
> Try:
> 
> WsockCloseSocket(Socket)
> 
> WsockCloseSocket is included in srvsckip.ew

I am.
 
> Also, you probably want to send this header to the browser when you
> return the page:
> 
> Connection: close

I am:
tmp=WsockSendData(Socket,"HTTP/1.1 200 OK"&CRLF&
                         "Server: TiggrBot"&CRLF&
                         "Date: "&sprintf("%d",date())&CRLF&
                         "Expires: "&sprintf("%d",date())&CRLF&
                         "Content-type: text/html"&CRLF&
                         "Connection: close"&CRLF&CRLF&
"<html><head><title>TiggrServer
                         test</title></head>"&CR&
                         CRLF&CRLF)
 
Which works fine (i know the date is wrong, but the big problems get first 
attention), IE likes it fine, but in a dos box, netstat /a says the ports are
still
in use. Which might explain why i must wait a while before 
WsockRecv(Socket, 65535) gives me valid data again. The sockets are 
timing out, they are not being closed by me. This happened in mirc too, but 
mirc has a sockclose that *does* work, the sockets are forced closed, even 
if the data in them is unsent, and there is a command to see if the data was 
retrieved by the client too. Anyhow, not being able to close the connection is 
unacceptable, so what can i do?


> > Kat
> 
> Good luck with whatever project your doing here :)

Thanks! smile
Since i broke the working irc client that was using tcp4u, and since i wanted 
better async operation and a multipurpose interface, i thought i'd give this a 
try.

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu