Hi
My hosting company no longer permits connection to any port other than standard ones and I am in the middle of a project that is best solved via sockets (I think).

I use a mysql database and connect to it via php. I need 4 people to use client sockets to connect to a server socket with access to the database. Small datapackets would be sent when necessary from clients to server and back. (I am building the interface in Flash but other methods not a problem).

I used to do a lot of this a while back with no problem but now I cannot find a hosting company that will let me do it.
2 full days spent calling, emailing companies and no joy!
Anyone know a hosting company that will permit it?
OR have things moved on and there is a better method?

Maky thanks in advance.

Eldoc

Dani AI

Generated

As described, the core constraint is not the idea of sockets but the hosting environment: many shared plans forbid listening on arbitrary TCP ports or running persistent daemons. The thread already contains two useful directions from members: run something locally for development () or move to a hosting tier that gives you process/network control (as implied). Below are practical, up-to-date options and things to check.

If you need true TCP sockets (persistent, low-latency): use an environment that lets you run a background process and open TCP ports (VPS/cloud/compute instance). Run the socket server outside the web-tier (Node/Python/Java/C etc.), keep the database access local to that process (do not expose MySQL to the public Internet), and harden the service with authentication, TLS, and firewall rules.

If you cannot change hosting: adapt the design to work over HTTP(S). For small numbers of clients, simple polling or long-polling (Comet) implemented in PHP will work. Modern options include WebSockets (over port 80/443) which give true bidirectional comms but require server support or a proxy that upgrades HTTP. These HTTP-over-80 approaches avoid blocked custom ports on shared hosts.

Flash-specific note: Flash sockets require a socket policy file. The player will request the policy (usually via a designated policy port or on the target socket). Make sure a restrictive policy server is present so the Flash client can connect without exposing services widely.

Quick checklist to ask prospective hosts:

  • Can I run persistent/background processes?
  • Can I bind/listen on custom TCP ports or on ports 80/443?
  • Are there outbound/inbound firewall rules or NAT restrictions?
  • Is the provider OK with long-running TCP daemons?

Security first: never expose the DB directly, use TLS, authenticate clients, and limit access by IP or token.

Recommended Answers

All 7 Replies

You'll need a dedicated server for that. No one wants other sites bringing the server down for everybody.

ever thaught about just hosting it on your LAN using xampp? (Firewall!!!)

thats what I do for college CGI/Perl development, not recommeneded for internet hosting but for development its great (comes out of the box with phpmyadmin etc...) configured

Check your housting company to support socket program. Simley check your hosting support perl & php application

Check your housting company to support socket program. Simley check your hosting support perl & php application

Sorry vssp I don't understand what you mean. My hosting does perl and php but do not allow access to 'registered ports' (those above 1023). So, how can I set up a server socket on the host's server?

Perhaps I have got it all wrong - please let me know.

Many thanks
eldoc

Check these guys:

Hi
My hosting company no longer permits connection to any port other than standard ones and I am in the middle of a project that is best solved via sockets (I think).

I use a mysql database and connect to it via php. I need 4 people to use client sockets to connect to a server socket with access to the database. Small datapackets would be sent when necessary from clients to server and back. (I am building the interface in Flash but other methods not a problem).

I used to do a lot of this a while back with no problem but now I cannot find a hosting company that will let me do it.
2 full days spent calling, emailing companies and no joy!
Anyone know a hosting company that will permit it?
OR have things moved on and there is a better method?

Maky thanks in advance.

Eldoc

I am not 100% sure what you need to do but my hosting company is computinghost.com you could try them. They seem to be pretty flexible about the the sockets you use.

Great - many thanks elderp - what a wonderful hosting company - real people who you can contact and they understand what you are talking about. May your connections be plentiful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.