Link to home
Start Free TrialLog in
Avatar of frankmorrison
frankmorrison

asked on

Can PHP do port forwarding?

I have a client/server application.  The client application connects to the server on port 2356 like this:  connect http://www.myserver.com:2356.  The server also has an IIS web server listening on port 80 with PHP installed.

I would like to create a PHP port forwarder script that will allow my client application to connect using port 80 like this: connect http://www.myserver.com/portfowarder.php 

The portfowarder.php script will act like a standard tcp/ip port fowarder connecting whatever is sent to the server application listening on port 2356.  

I am not an expert PHP person, so please try to be very specific.  Sample working code preferable.
Avatar of Itsacon
Itsacon
Flag of Netherlands image

You could try something like this for the portforwarder.php file:

<?php
header("Location: http://".$_SERVER['HTTP_HOST'].":2356");
?>

It does require the the client application to have full HTTP implementation, but you'll just have to test it to find out.
ASKER CERTIFIED SOLUTION
Avatar of theevilworm
theevilworm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial