Page 1 of 1

Sending through one port to be receive by another...

Posted: Tue Jul 22, 2008 7:01 pm
by JellyFish
Is it possible to send data packets through one port on your server to be received by another port on another other server? For example let's say I was using php to send a file using the cURL methods/extension through port 80, but I wanted the packet/file to be received on port 1129 or any other port.

Is this totally incorrect?

PS: I think I placed this in the wrong forum. Woops!

Re: Sending through one port to be receive by another...

Posted: Wed Jul 23, 2008 9:24 am
by dml
The source port usually doesn't matter, it's just assigned by your machine when you make the connection. If you're trying to connect to a http server running on something other than port 80, you should be able to add it to the hostname in the url, eg, http://example.com:1234/ .

Re: Sending through one port to be receive by another...

Posted: Wed Jul 23, 2008 4:16 pm
by JellyFish
Interesting. I wonder why then would a payment gateway require me to use a specific port to send a file to them?

What if HTTPS was involved?

Re: Sending through one port to be receive by another...

Posted: Wed Jul 23, 2008 5:17 pm
by dml
Just to be clear, this is a payment gateway that's invoked by you making https requests to their server? I think https defaults to port 443, and of course the payment provider could choose to run a https server on whatever other port they liked. Paste in the relevant part of the API, and somebody here will know for sure, but I would assume that they're specifying the port on their side*. Requiring a single port on your side would be very very awkward, starting with the problem that you could only have one connection at a time open to the gateway.

* I'm assuming you know that there are _two_ ports involved in every HTTP connection, the one on the client machine and the one on the server machine? When we say that we're connecting through a port, it usually refers to the server-side port.

Re: Sending through one port to be receive by another...

Posted: Thu Jul 24, 2008 2:00 pm
by JellyFish
Yes I figured that there are two ports involved in a HTTP request. But what I don't understand is why my payment gateway would require a port opened on my side? Their requiring me to have port 1129 opened on my side but the only ports open on my server are 80, 443, 2153, 306, and 21.

I don't see why they wouldn't want me connecting through port 443 and on their end 1129.

What part of the API would be relevant other then when I create a new field called port:

Code: Select all

 
$myorder['port'] = "1129";
 
?

Re: Sending through one port to be receive by another...

Posted: Thu Jul 24, 2008 3:28 pm
by dml
Emm.... I'm still not sure if I understand this correctly. Is it that your payment gateway requires you to connect to them on port 1129, but your server is behind a firewall that blocks outgoing connections to that port? I don't know any way around that apart from asking the network admins to unblock the port. What happens when you try to connect, what sort of error messages do you get?

Re: Sending through one port to be receive by another...

Posted: Thu Jul 24, 2008 5:38 pm
by JellyFish
Well it's both. I know that my servers firewall is blocking port 1129 and my gateway requires me to open port 1129 in order to use their API.

The question I'm after is why would they require port 1129 open if it doesn't effect them on their part?

Re: Sending through one port to be receive by another...

Posted: Thu Jul 24, 2008 6:12 pm
by dml
I'd assume that they're running a httpd server on port 1129. Why they're running it on a non-standard port, I don't know. Have you confirmed by trying to connect that your firewall is blocking the port for outward connections? It would make sense to block everything into your server except 80 etc, but not so much to block outgoing connections.