Page 1 of 1

Can i use Port 80 for an TCP Connection ?

Posted: Thu Jul 15, 2010 4:04 pm
by seulater
I need to transfer some data to my MOD board via TCP. I have it working on another port but it seems that when we sell these to large corporations, its the IT guys that complain about opening up a port.
I though to get around this issue, i could use the always open port of 80. If i dont allow the HTTP service to start by commenting out the StartHTTP(); then maybe i could then use the following TCP listener for port 80.

int fdListen = listen(INADDR_ANY, 80, 1);

I know i can just try it, but i am leaving now and wont be back for a while.


Whatcha tink ?

Re: Can i use Port 80 for an TCP Connection ?

Posted: Thu Jul 15, 2010 6:51 pm
by tod
If it smells like a port, walks like a port, and talks like a port then by golly it must be a port. I just took the telnet example code (default port 23) and told it to use port 80 and I could telnet in. The only potentially worrisome part is when I hit the NB with a browser I got back a bunch of Telnet gobbledy book. I then tried it with one of my standard TCP server projects and it also worked and the web browser didn't return anything. You should be fine.

Re: Can i use Port 80 for an TCP Connection ?

Posted: Thu Jul 15, 2010 8:29 pm
by seulater
Cool, thanks for tying and the update.

Re: Can i use Port 80 for an TCP Connection ?

Posted: Thu Jul 15, 2010 10:28 pm
by yevgenit
Do you need Telnet connection without the well known TCP port 23?
Why to confuse with port 80, which is well known for HTTP?
You can arrange any unused TCP port.
See http://www.iana.org/assignments/port-numbers

Re: Can i use Port 80 for an TCP Connection ?

Posted: Fri Jul 16, 2010 4:43 am
by rnixon
If you did want to still have the web server active for local access, you can change its port number by specifying it in the StartHTTP() call, like StartHTTP(8080);

Re: Can i use Port 80 for an TCP Connection ?

Posted: Fri Jul 16, 2010 5:38 am
by seulater
Do you need Telnet connection without the well known TCP port 23?
Why to confuse with port 80, which is well known for HTTP?
You can arrange any unused TCP port.
I dont need a Telnet connection, i need to transfer data. Typically port 80 is always open. If i do it this way i wont need to bother the IT people to open a port.

Re: Can i use Port 80 for an TCP Connection ?

Posted: Fri Jul 16, 2010 10:02 am
by pbreed
Be careful with your assumptions , port 80 MAY be open for OUTGOING connections.
It may also be redirected to a proxy server that won't know your protocol.

It will not be open for incoming connections.
There is really no easy painless way to go from outside an organization to
a device inside the organization.

The most robust way is to have an external server visible (Say at your company) outside and have
the device behind someone elses firewal etc.. on the inside make an outgoing TCP connection to your server.

Most organizations will allow outgoing TCP connections on most ports.


The key is this if you need to initate a connection from outside the firewall its going to almost impossible with most large IT organizations.

Most systems have a NAT firewall at some point that will kill all incomming connections.

Connections going from inside to outside are much easier to get done.

Please expliain what you are trying to do in some detail and we can offer some advice.

Paul

Re: Can i use Port 80 for an TCP Connection ?

Posted: Fri Jul 16, 2010 11:14 am
by seulater
Well, my plan is to do this.
i will start the HTTP service, StartHTTP();
i have created a flash site that when served up from the MOD board opens another TCP connection back to the unit to transfer data back and forth.

My idea is that once the mod board finishes serving up the flash site to the client, i will stop the HTTP service so that port 80 is available. when the flash site starts on the clients computer it will then open a port 80 connection back to the MOD board and transfer the data using port 80 instead of another port.

The user is connection to the device from the outside using port 80, then i turn around and use port 80 back.

I am NO TI guru by any means. so i would imagine there are flaws in this concept.

Now that has me thinking, how does programs like GotomyPC and TeamViewer get around all these port and NAT issues ?

Re: Can i use Port 80 for an TCP Connection ?

Posted: Fri Jul 16, 2010 11:01 pm
by yevgenit
Why to violate the regular network behavior?
HTTP is intended for short transactions. After finishing the HTTP transaction, close the connection. The running HTTP service is listening for a future connection at port 80.

Re: Can i use Port 80 for an TCP Connection ?

Posted: Sat Jul 17, 2010 5:46 am
by seulater
Why to violate the regular network behavior?
read my first post in this thread.

HTTP is intended for short transactions. After finishing the HTTP transaction, close the connection. The running HTTP service is listening for a future connection at port 80.
ya, HTTP is, but i am not using HTTP, i just want to use port 80.