http

i'm attempting to make sort of a http server for the hell of it. i use winsock to handle the connections and as of now it handles very little. when i run it, and connect to "0.0.0.0/test.htm"(test html file in c:) it works. but when someone from a different computer tries to do that, it won't. any ideas?

Comments

  • : i'm attempting to make sort of a http server for the hell of it. i
    : use winsock to handle the connections and as of now it handles very
    : little. when i run it, and connect to "0.0.0.0/test.htm"(test html
    : file in c:) it works. but when someone from a different computer
    : tries to do that, it won't. any ideas?
    Uh...you're enabling your entire C drive to be accessed by HTTP? Maybe it's a good job it doesn't work! ;-)

    Things to check - is it listening on your external IP address (the one you get from your ISP when you connect to the net)? If so, do you have a firewall enabled that is blocking connections to your http server?

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • no its not opening up my c: to the internet. yes, it listens on my external ip address. here's my code.

    [code]
    Private Sub wskConn_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    Dim I As Integer
    Dim blnCheck As Boolean

    For I = 1 To wskConn.UBound
    If blnArray(I) = False Then
    wskConn(I).Accept requestID
    blnArray(I) = True
    blnCheck = True
    Else
    blnCheck = False
    End If
    Next I

    If blnCheck = False Then
    Load wskConn(wskConn.UBound + 1)
    wskConn(wskConn.UBound).Accept requestID
    blnArray(wskConn.UBound) = True
    End If
    End Sub

    Private Sub wskConn_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    FF = FreeFile
    strError = "ErrorError 404: File Not Found" _
    & ""

    wskConn(Index).GetData Incoming
    Pos1 = InStr(1, Incoming, " ")

    If Left(Incoming, Pos1 - 1) = "GET" Then
    Pos2 = InStr(1, Incoming, "/")
    midA = Mid(Incoming, Pos2 + 1) 'after 1st "/"
    Pos3 = InStr(1, midA, " ")
    midB = Left(midA, Pos3 - 1) 'filename
    FilePath = "C:" & midB
    ExtPos = InStr(1, FilePath, ".")
    ExtCheck = Mid(FilePath, ExtPos + 1)
    If ExtCheck = "htm" Or ExtCheck = "html" Then
    FileCheck = Dir(FilePath)
    If FileCheck <> "" Then
    Open FilePath For Input As #FF
    While Not EOF(FF)
    FileData = Input(LOF(FF), #FF)
    Wend
    Close #FF
    FileLength = Len(FileData)
    strValid = "HTTP/1.0 200 OK" & vbCrLf & "Date: Wed, 24 Sept 2003 23:59:59 GMT" _
    & vbCrLf & "Content-Type: text/html" & vbCrLf & "Content-Length: " _
    & FileLength & vbCrLf & vbCrLf & FileData
    wskConn(Index).SendData strValid
    DoEvents
    wskConn(Index).Close
    blnArray(Index) = False
    Else
    FileLength = Len(strError)
    wskConn(Index).SendData " HTTP/1.0 404 Not Found" & vbCrLf & "Date: Fri, 19 Oct 2003 23:59:59 GMT" _
    & vbCrLf & "Content-Type: text/html" & vbCrLf & "Content-Length: " _
    & FileLength & vbCrLf & vbCrLf & strError
    DoEvents
    wskConn(Index).Close
    blnArray(Index) = False
    End If
    Else
    FileLength = Len(strError)
    wskConn(Index).SendData " HTTP/1.0 404 Not Found" & vbCrLf & "Date: Fri, 19 Oct 2003 23:59:59 GMT" _
    & vbCrLf & "Content-Type: text/html" & vbCrLf & "Content-Length: " _
    & FileLength & vbCrLf & vbCrLf & strError
    DoEvents
    wskConn(Index).Close
    blnArray(Index) = False
    End If
    End If
    End Sub
    [/code]
  • [b][red]This message was edited by Jonathan at 2003-9-25 16:33:30[/red][/b][hr]
    : no its not opening up my c: to the internet. yes, it listens on my
    : external ip address. here's my code.
    Don't see anything that would stop external connection there. Just ensure you are giving an external IP address, your firewall is not blocking the requests, and if you are on a network that connects to the net ensure you are not giving your network address out, but rather a routable one. Run ipconfig and the command line to figure out what IP addresses your PC listens on...

    What error does a user trying to connect get? Can the user ping you?

    Jonathan


    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • : [b][red]This message was edited by Jonathan at 2003-9-25 16:33:30[/red][/b][hr]
    : : no its not opening up my c: to the internet. yes, it listens on my
    : : external ip address. here's my code.
    : Don't see anything that would stop external connection there. Just ensure you are giving an external IP address, your firewall is not blocking the requests, and if you are on a network that connects to the net ensure you are not giving your network address out, but rather a routable one. Run ipconfig and the command line to figure out what IP addresses your PC listens on...
    :
    : What error does a user trying to connect get? Can the user ping you?
    :
    : Jonathan
    :
    :
    : ###
    : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

    the error is "Page cannot be displayed". i can be pinged and i did a traceroute to make sure. i use the same code pretty much in a chat program i made, and people will connect to me on that fine so its really confusing/pissing me off.

  • : the error is "Page cannot be displayed". i can be pinged and i did a traceroute to make sure. i use the same code pretty much in a chat program i made, and people will connect to me on that fine so its really confusing/pissing me off.
    :

    Kinda sounds like it might be a logic error in your program. Since there is a timeout, you would have a few seconds to allow someone (or yourself) to try to connect with your app running in VB in order to step through the function.
  • : : the error is "Page cannot be displayed". i can be pinged and i did
    : : a traceroute to make sure. i use the same code pretty much in a
    : : chat program i made, and people will connect to me on that fine so
    : : its really confusing/pissing me off.
    ISP blocking port 80 perhaps? Some do it. Have you been able to run other web servers on your PC? Try one of those and see if people can connect. If they can, then it's your program.

    : Kinda sounds like it might be a logic error in your program. Since
    : there is a timeout, you would have a few seconds to allow someone
    : (or yourself) to try to connect with your app running in VB in order
    : to step through the function.
    True, though you might be able to work around a web browser based timeout by using something like Telnet to connect on Port 80. If the connection isn't established far enough to make a request though, that ain't going to help either... Depends where the problem is.

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • i will try running another web server like apache and see if that will work. thanks for your guy's help.
  • : no its not opening up my c: to the internet. yes, it listens on my external ip address. here's my code.
    :
    : [code]
    : Private Sub wskConn_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    : Dim I As Integer
    : Dim blnCheck As Boolean
    :
    : For I = 1 To wskConn.UBound
    : If blnArray(I) = False Then
    : wskConn(I).Accept requestID
    : blnArray(I) = True
    : blnCheck = True
    [blue]Exit For[/blue]
    : Else
    : blnCheck = False
    : End If
    : Next I
    :
    : If blnCheck = False Then
    : Load wskConn(wskConn.UBound + 1)
    : wskConn(wskConn.UBound).Accept requestID
    : blnArray(wskConn.UBound) = True
    : End If
    : End Sub
    [/code]

    I don't know if this is related to the issue at hand, but you don't have an Exit For after accepting the connection. It looks to me like you're going to have a whole array of winsocks accepting the same connection.


    [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]

  • : I don't know if this is related to the issue at hand, but you don't have an Exit For after accepting the connection. It looks to me like you're going to have a whole array of winsocks accepting the same connection.
    :

    Unless he has a huge array, it shouldn't be causing this error. But that is a very good point. Only the first unopen winsock would be able to accept the connection; all the others would error out...

    Good eye infidel!
  • : : I don't know if this is related to the issue at hand, but you don't have an Exit For after accepting the connection. It looks to me like you're going to have a whole array of winsocks accepting the same connection.
    : :
    :
    : Unless he has a huge array, it shouldn't be causing this error. But that is a very good point. Only the first unopen winsock would be able to accept the connection; all the others would error out...
    :
    : Good eye infidel!
    :
    i will add that in, but i still havn't figured out what's causing the problem in the first place.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories