Forum Moderators: open
How I can disable other programs in windows, so they won't be listening to port 80. I know that TCP is listening to that port, so:
How can I disable it? or better
How can I use this program, already listening to port 80, to connect my server to this TCP?
Port 80 is one of over 65000 ports available for TCP communications, and is traditionally reserved for HTTP connections.
If port 80 is taken, that most likely means you have a webserver running on your computer. Perhaps Apache or IIs or the PWS Personal version.
Get a good TaskManager (like TaskInfo) and identify them on the list. Kill all the server tasks and se if your program can then bind to port 80. Low levelr socket programming is somewhat complex, and I suggest you read up all you can find on IP, TCP, HTTP and socket programming. It can take quite a bit of learning to get used to all the details.
If you want to get rid of your local web server for good, type "services.msc" in a command window, and change all webservers to "manual".
Best of luck,
SN
If you could explain in a little more detail what you are trying a achieve, teh ASP gurus around could help you more I'm sure. I've only done low level socket programming, and no ASP.
SN
I already make a program that allows many users to chat with each other.
The "server" rund in port 6180, but this only works in my internal network. If the server was behind a firewall, then it wouldn't work.
That is why I want to start my program listening to port 80, so no firewall will intervine in the process.
TCP is listening to port 80, but I don'e have any web server running at this moment. TCP start by default.
If I don't disable TCP, can I some how use it for my applicaiton?
Now I have this:
My program is running in two different computers, one acts as a "server" and the other one as a "client". When the "client" says "hello", then the "server" gets this information and here is the deal:
Computer one which is the "server", after getting "hello" becomes a "client" and syas "I am here".
Computer two, which was a "client", becomes a "server", so it can listen and get "I am here".
Is there a better way to create an application, so the computer doesn't have to be client and server at the same time?
You bind to a listen port, in your case port 80. When the connection is established, you are actually talking to one of the freely assignable ports above 1024.
So it goes like this:
C:port 43000 -> S:port 80 : Connect
S:port 80 -> C:port 43000 : let's talk on port 54000
C:port 43000 -> S:port 54000 : Hello
S:port 54000 -> C:port 43000 : Got your hello
Now the assigning of the new port is random and automatic. depending on your language, after reciving the first connection on your lsiten port, you have some form of connection object, which has the new port assigned.
firewalls are no issue fomr here on onwards, because they only block NEW connections. Once the connection is established through port 80, you can talk on the new ports.
But it would be much easier to open a new port in the firewall. Because if hte computer does NOT run a webserver on port 80, then cahnces are port 80 woiuld be closed in the firewall as well.
SN
I create a program, the server listens to port 80. Then I should change the port number, so the server can listen to port 5000. When I try to change the port number, it crashes. I get a message telling me that I can not change the port number when the server is active.
If I deactivate the server, then I will have to start the process again, it will be like starting my program with my server listening to port 5000.
How can I change the port that the server is listening and keep the connection?
Internet Explorer is a client, it send data to port 80, and it gets an answer from throught that port.
When it send the request, it is a client. When it gets back the web site, it is :
- A server listening to port 80?
- It is a client that is able to listen to incomming data?
use NET or a packet sniffer to check on your internet explorer connections, and you will notice that in fact IE does NOT get the response back on port 80. Otherwise, only one client could only ever connect to awebservcer at a time, which is obviously not true.
SN
Explorer is a client and a server?
If the computer "A" send something to computer "B", then computer "A" can not get any answer babk, unless "A" is also a server.
If computer "A" send something to "B", then computer "A" is a client, how can computer "A" get something from "B", if "A" is behind a firewall?
Once "A" sent data to "B", "B" can send something to any other port above 1024 and "A" will get it without any firewall problem, becuase "A" already opened a connection with "B"?
Could you please tell me if those things I wrote are right?
Explorer is a client and a server?
No, internet explorer is only a client. A server is something that sits and waits until it's asked for something but doesn't actually issue requests. A client on the other hand doesn't actually sit and wait, but instead just issues requests.
On the other hand things like P2P applications are both clients and servers at the same time because they issue their own requests (client) and deal with incoming requests that they listen for (server).
If the computer "A" send something to computer "B", then computer "A" can not get any answer babk, unless "A" is also a server.
No, "A" (client) sends something to "B" (server) and then gets a response back within that same connection - this is exactly how a website works on a simple level with one client (my browser) and one server (e.g. apache or IIS)
If computer "A" send something to "B", then computer "A" is a client, how can computer "A" get something from "B", if "A" is behind a firewall?
The connection is established by "A" from inside the firewall, and the response from "B" is returned in this same connection therefore there are no firewall problems since no new connections are being opened.
If "B" (external server) needed connect to "A" (client) without "A" establishing the connection then you would have firewall problems since that would be viewed as unprompted.
Once "A" sent data to "B", "B" can send something to any other port above 1024 and "A" will get it without any firewall problem, becuase "A" already opened a connection with "B"?
Port allocation is normally handled for you so you don't need to worry about exactly which port you are using once the initial connection is established.
In the example your connection was being handled on port 54000 on the server, which is fine ... but if you try to send data on a second connection to server port 54001 then your connection will be refused.
Equally it's not true to say that just because there is already one "trusted" connection from "A" to "B" that "B" can now connect directly to "A" on another connection and bypass the firewall.
Could you please tell me if those things I wrote are right?
They are heading in the right direction but if we understood you correctly you aren't quite understanding the idea yet. You might want to try doing more background research via Google since it has a lot of technical material indexed.
- Tony
I urge you to read up on hte basics of TCP. It's quite complex, and would be hard to explain staisfactorily in a thread here. Perhaps somebody can suggest a good tutorial to TCP programming.
SN
Te souce code should be something really simple, a client sends something a another computer, and this last one replies with a message.
If I run the program, then I will get a better understanding of it. My application is created in Broland C++, so the client-server connection and so on is handled by pre-built Borland functions.
Take a look at this example, and the other proxy server etc examples on the same site.
[rebol.org...]
I just did something in Borland:
I have computer "A" which is the client and is behind a firewall.
Computer "B" is the server, and it is not behind a firewall. "B" is listening to port 6180.
Now, "A" starts and gets connected to "B", and "B" repplyes hello.
"A" is behind a firewall, but It got the message anyways, because it was the one opening a conecction.
This is bettween "A" and "B". How about if computer "C" enters the picture, and "C" is also a server, but it is "A" and "C" who want to talk to each other and they are both behind a firewall? The only way to get connected will be through "B". HOW?
after you have digested that, you will need to
figure out multi-threading, and particular to
win32, async i/o.
then, once you have it running as a console app,
you will need to figure out how to modify it
to run as a service.