Sign in to follow this  
Followers 0
notsure

How to? Webserver

5 posts in this topic

#1 ·  Posted (edited)

Hello,

I'm trying to build a small webserver but i can't really get it to work. I tried alot of things, here's my code;

Can anyone help me out or give me a hint how to do this? I guess this wont work quite well with the HTTP protocol

Edit;

Also if i use HTTP strings like this;

local $sData = "HTTP/1.1 200 OK"  & @crlf & _
"Date: Tue, 29 Apr 2014 13:21:18 GMT" & @crlf & _
"Server: Bla" & @crlf & _
"X-Powered-By: Power" & @crlf & _
"Content-Length: 11" & @crlf & _
"Connection: close" & @crlf & _
"Content-Type: text/html; charset=utf-8" & @crlf 
 
It wont quite work :/
#include <MsgBoxConstants.au3>
 
TCPStartup()
 
Local $sIPAddress = @IPAddress1
Local $iPort = 80
 
Local $iListenSocket = TCPListen($sIPAddress, $iPort, 100)
Local $iError = 0
 
Local $iSocket = 0
While 1
        $iSocket = TCPAccept($iListenSocket)
 
        ; If an error occurred display the error code and return False.
        If @error Then
            $iError = @error
            MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not accept the incoming connection, Error code: " & $iError)
        EndIf
if $iSocket <> -1 Then
consolewrite(TCPRecv($iSocket,100))
TCPSend($iSocket, "hello this is a webserver")
ExitLoop
EndIf
WEnd ;if different from -1 a client is connected.
 
 
 
TCPShutdown()
Edited by notsure

Share this post


Link to post
Share on other sites



Hi,

I can tell you it works fine, your code is simply wrong.

I can't see anything here that can receive and send a proper response, please post your full code.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi,

I can tell you it works fine, your code is simply wrong.

I can't see anything here that can receive and send a proper response, please post your full code.

Br, FireFox.

 

Hi FireFox,

This is my full code till now... is there any webserver UDF or something?

And what do you mean with : Its working fine?!

Nothing is working, except i can connect to Port80 TCP.

Thanks in advance,

Notsure.

Share this post


Link to post
Share on other sites

This is my full code till now... is there any webserver UDF or something?

A lot of code is missing then.

There's a search engine ;)

And what do you mean with : Its working fine?!

I already made a limited webserver.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

A lot of code is missing then.

There's a search engine ;)

I already made a limited webserver.

Br, FireFox.

Hi Firefox,

I did use the search engine, but all hits ive seen are about winHTTP CLIENT-acting, not acting as server.

Could i have a look at your limited webserver, where can i find this?

Thanks alot man!

Gr,

Notsure.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0