Discussion:
Creating a simple file server - port problems
(too old to reply)
MC
2008-03-16 11:00:15 UTC
Permalink
I wrote a simple file server mainly to be able to send software updates to my
customers.

Evrything works fine. I am using TCP and the server is using port 12500.

The problem is that many customers have ports closed and simply refuse to open
12500. One answer is to tell my customers to go to router setting and open port
12500 which is not a very good idea. Router setting are confusing and even I have
diffuculties opening ports on some routers I've tested.

How should I tackle this problem? I tried ports 80 and 21 and it failed. How does
my FTP program get around this?
PeterD
2008-03-16 22:14:04 UTC
Permalink
Post by MC
I wrote a simple file server mainly to be able to send software updates to my
customers.
Evrything works fine. I am using TCP and the server is using port 12500.
The problem is that many customers have ports closed and simply refuse to open
12500. One answer is to tell my customers to go to router setting and open port
12500 which is not a very good idea. Router setting are confusing and even I have
diffuculties opening ports on some routers I've tested.
How should I tackle this problem? I tried ports 80 and 21 and it failed. How does
my FTP program get around this?
Why does 80 not work for you? Web servers do a good job of sending
files (we do it all the time) and various tools (what
language/platform are you using?) make such a trick easy. My code, in
VB6, is perhaps 25 lines (much is error handling) and straigth
forward. It fetches a file, then runs it optionally. (in my program I
have created a standalone command line (console app) program.

You definately want to avoid using your own port for whatever reason,
most users will *not* open a port for your application.
MC
2008-03-17 07:07:28 UTC
Permalink
Post by PeterD
Post by MC
I wrote a simple file server mainly to be able to send software updates to my
customers.
Evrything works fine. I am using TCP and the server is using port 12500.
The problem is that many customers have ports closed and simply refuse to open
12500. One answer is to tell my customers to go to router setting and open port
12500 which is not a very good idea. Router setting are confusing and even I have
diffuculties opening ports on some routers I've tested.
How should I tackle this problem? I tried ports 80 and 21 and it failed. How does
my FTP program get around this?
Why does 80 not work for you? Web servers do a good job of sending
files (we do it all the time) and various tools (what
language/platform are you using?) make such a trick easy. My code, in
VB6, is perhaps 25 lines (much is error handling) and straigth
forward. It fetches a file, then runs it optionally. (in my program I
have created a standalone command line (console app) program.
You definately want to avoid using your own port for whatever reason,
most users will *not* open a port for your application.
OK I had a typo in my source and port 80 works Ok now.
Jeffrey Adler
2008-03-17 04:01:07 UTC
Permalink
Post by MC
I wrote a simple file server mainly to be able to send software updates to my
customers.
Evrything works fine. I am using TCP and the server is using port 12500.
The problem is that many customers have ports closed and simply refuse to open
12500. One answer is to tell my customers to go to router setting and open port
12500 which is not a very good idea. Router setting are confusing and even I have
diffuculties opening ports on some routers I've tested.
How should I tackle this problem? I tried ports 80 and 21 and it failed. How does
my FTP program get around this?
When you write a server program, outside folks must be able to "hit" your
inside machine by port number. As you found, this can be easier said than
done, especially if your clients have their machines behind a business
firewall. It becomes even more difficult when the client's buisness model
doesn't allow for outside access to the inside servers.

Instead, you may want to have your application initiate a connection to YOUR
IP address. Then your server can decide if it wants to send data to the
client's machine.
MC
2008-03-17 06:53:41 UTC
Permalink
Post by Jeffrey Adler
Post by MC
I wrote a simple file server mainly to be able to send software updates to my
customers.
Evrything works fine. I am using TCP and the server is using port 12500.
The problem is that many customers have ports closed and simply refuse to open
12500. One answer is to tell my customers to go to router setting and open port
12500 which is not a very good idea. Router setting are confusing and even I have
diffuculties opening ports on some routers I've tested.
How should I tackle this problem? I tried ports 80 and 21 and it failed. How does
my FTP program get around this?
When you write a server program, outside folks must be able to "hit" your
inside machine by port number. As you found, this can be easier said than
done, especially if your clients have their machines behind a business
firewall. It becomes even more difficult when the client's buisness model
doesn't allow for outside access to the inside servers.
Instead, you may want to have your application initiate a connection to YOUR
IP address. Then your server can decide if it wants to send data to the
client's machine.
Isn't that what I am doing. My customer connects directly to my IP but TCP
connection need a port open at both sides. During the connection the customer
sends messages ("SEND thifile.txt") to my computer when then sends an OK and the
file.
Jeffrey Adler
2008-03-17 19:06:22 UTC
Permalink
Post by MC
Post by Jeffrey Adler
Post by MC
I wrote a simple file server mainly to be able to send software updates
to
my
customers.
Evrything works fine. I am using TCP and the server is using port 12500.
The problem is that many customers have ports closed and simply refuse
to
open
12500. One answer is to tell my customers to go to router setting and
open
port
12500 which is not a very good idea. Router setting are confusing and
even
I have
diffuculties opening ports on some routers I've tested.
How should I tackle this problem? I tried ports 80 and 21 and it failed. How does
my FTP program get around this?
When you write a server program, outside folks must be able to "hit" your
inside machine by port number. As you found, this can be easier said than
done, especially if your clients have their machines behind a business
firewall. It becomes even more difficult when the client's buisness model
doesn't allow for outside access to the inside servers.
Instead, you may want to have your application initiate a connection to YOUR
IP address. Then your server can decide if it wants to send data to the
client's machine.
Isn't that what I am doing. My customer connects directly to my IP but TCP
connection need a port open at both sides. During the connection the customer
sends messages ("SEND thifile.txt") to my computer when then sends an OK and the
file.
When you create a TCP connection to a server, the server usually exists on a
"known" port. (That's how the client FINDS the particular server on a
specific IP address)

The client gets a unused port number from the OS and uses that to connect to
the server port, so the whole connection consists of:

Client:some_random_port <==> Server:known_port

The client must be able to open a specific port on the server, and the
clients firewall can't block that specific outgoing request. Other than
that, all should work.

Continue reading on narkive:
Loading...