🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #7750

Http server VB6

#7750
From: ThomasL
Date: Sun, 11 Aug 2002 15:50
54 lines
2346 bytes
Hey
Ik ben in vb6 met winsock aan het experimenteren.  Voor de lol heb ik een
HTTP servertje ineengebokst,  het is gewoon een winsock server op poort 80
die als er data wordt ontvangen op de poort, een string terugstuurt.  Het
heeft gewerkt, maar momenteel werkt het niet meer, heeft iemand een idee van
wat er mis is?

benodigd:
leeg form met winsock control met naam "WinS"
code:

Option Explicit
Dim Tekst, Temp As String
Dim nfile As Single

Private Sub Form_Load()
nfile = FreeFile

Open "c:\thomas\home.html" For Input As nfile
Temp = Input(LOF(nfile), nfile)
Tekst = "HTTP/1.1 200 OK" & vbCrLf & "Connection: Close" & vbCrLf &
"Content-Type: text/html" & vbCrLf & "Content-Lenght: " & Len(Temp) & Temp
Close nfile

WinS.LocalPort = 80
WinS.Listen

End Sub

Private Sub WinS_ConnectionRequest(ByVal requestID As Long)
If WinS.State <> sckClosed Then
    WinS.Close
End If
WinS.Accept requestID
End Sub


Private Sub WinS_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
WinS.GetData Data
WinS.SendData Tekst
Debug.Print Data
Debug.Print Tekst
WinS.Close
WinS.Listen
End Sub

bvbd. thomas

--
=-==========|Thomas Langewouters|===============-=
------> Hobyist & Student Electronics <-----------
-------> Lives in Herentals, Belgium <------------
> WEBSITE: http://home.pi.be/~p4u09003/home.html <
Technical Details
Message-ID: <aj81n5$kq4$1@reader10.wxs.nl>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!diablo.theplanet.net!kibo.news.demon.net!demon!news2.euro.net!newsfeed.wxs.nl!news.wxs.nl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,35c6f4e126d44d16,start
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2002-08-12 03:18:09 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!diablo.theplanet.net!kibo.news.demon.net!demon!news2.euro.net!newsfeed.wxs.nl!news.wxs.nl!not-for-mail
From: "ThomasL" <thomas.langewouters@nospam.pi.be>
Newsgroups: be.comp.programming
Subject: Http server VB6
Date: Sun, 11 Aug 2002 17:50:48 +0200
Organization: Planet Internet
Lines: 58
Message-ID: <aj81n5$kq4$1@reader10.wxs.nl>
NNTP-Posting-Host: u212-239-155-16.freedom.planetinternet.be
X-Trace: reader10.wxs.nl 1029147173 21316 212.239.155.16 (12 Aug 2002 10:12:53 GMT)
X-Complaints-To: abuse@planet.nl
NNTP-Posting-Date: 12 Aug 2002 10:12:53 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300