|
-
Jul 11th, 2006, 02:30 PM
#1
Thread Starter
New Member
simple HTTP server
I am working on making a simple HTTP server and I am having some problems getting it to connect properly. The relevant code is below. Winsock1 is a winsock control located on Form1, which is the startup object of the project.
VB Code:
Option Explicit
Private Sub Form_Load()
Winsock1.LocalPort = 80
Winsock1.Listen
End Sub
Private Sub Winsock1_ConenctionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
MsgBox "Hello"
End Sub
When I open http://*.*.*.* from a browser (where *.*.*.* represents my computer's IP address), I get the message box notification as desired and expected. If however I get a friend to go to http://*.*.*.* nothing happens. My friend also reports that browser times out trying to connect.
At first I thought that the firewall was the problem, but I have disabled Windows Firewall (I am running XP SP2 by the way). My IP address responds to pings, but I get no message box when my friend tries to connect on port 80.
Can anyone help me?
-
Jul 11th, 2006, 02:57 PM
#2
New Member
-
Jul 11th, 2006, 03:14 PM
#3
Thread Starter
New Member
Re: simple HTTP server
Hey there, and thanks for the reply. Unfortunately this is not what I was looking for. I know about headers but the code hasn't gotten to that point yet.
The problem is that I can only connect to my "server" from the computer that is running it. I asked a friend to help me test and he cannot connect. And on my computer, no message box appears (see code in first post of thread) indicating that the Winsock1_ConenctionRequest event was not triggered.
At first I thought the firewall was causing this, so I made my app an exception to Windows Firewall but this did not solve my problem. Then I completely disabled Windows Firewall, so it should work, right? My IP address now replies to pings, yet no connection is made on port 80...
-
Jul 11th, 2006, 04:08 PM
#4
Hyperactive Member
Re: simple HTTP server
I found this problem, and it is usually because either your freind, or you, are on a network, or through a router, and therefore can't get at it. I am trying to solve this problem myself to be honest.
KAZAR
The Law Of Programming:
As the Number of Lines of code increases, the number of bugs generated by fixing a bug increases exponentially.
__________________________________
www.startingqbasic.co.uk
-
Jul 11th, 2006, 10:38 PM
#5
Fanatic Member
Re: simple HTTP server
This is easily fixed, I assume both of you have a router. Just goto www.portforward.com and figure out how to open port 80.
-
Jul 12th, 2006, 05:20 AM
#6
PowerPoster
Re: simple HTTP server
^
|
--- What he said .. if the server is on a PC that has a router between itself and the Internet, Port Forward Port 80 in your Router, and in your Firewall (or Windows Firewall with XPSP2) Open Port 80 (as that blocks incoming requests) .. this is because you are using TCP ports with winsock.
-
Jul 12th, 2006, 05:27 PM
#7
Re: simple HTTP server
Also be aware that some modems do the same thing the router does - network address translation - so you have to forward a port in the modem.
If your computer's internal IP address (the one you see if you open a command window and type ipconfig and look at the IP Address: line) is 192.<something>, 10.<something> or 172.<something>, you're behind something doing NAT.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 14th, 2006, 11:40 PM
#8
New Member
Re: simple HTTP server
I think you should change RemotePort to 80 and LocalPort to 80 from Custom Window .
and both you and your friend must be in a network and have one mask ip and one gate ip.
-
Jul 18th, 2006, 02:06 PM
#9
Re: simple HTTP server
 Originally Posted by diekick
I think you should change RemotePort to 80 and LocalPort to 80 from Custom Window .
and both you and your friend must be in a network and have one mask ip and one gate ip.
The only network both computers have to be in is the internet. Any two computers on the internet can transfer files if they (and whatever connects them to the internet) are configured properly.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 21st, 2006, 07:12 PM
#10
Lively Member
Re: simple HTTP server
Do yo have a router if so then you have to port forward
Port 80 -> 80
Also to see your external IP
http://cmyip.com
-
Jul 22nd, 2006, 08:27 AM
#11
Lively Member
Re: simple HTTP server
It's because you spelt connection wrong. Works fine for me.
-
Jul 22nd, 2006, 08:56 AM
#12
Lively Member
Re: simple HTTP server
 Originally Posted by skankerer
It's because you spelt connection wrong. Works fine for me.
Or it could be that he has a router !!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|