Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : PHP fsockopen question.
New Topic New Poll Post Reply
Poster Message
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon PHP fsockopen question. (0)  
I call this function...

$ret = fsockopen("127.0.0.1", 25, $errno, $errstr, 20);

It fails with the following value in $errstr: Failed to parse address "127.0.0.1"

I've tried different things for the first parameter:

tcp://127.0.0.1
tcp:127.0.0.1
localhost
caravelgames.com

...but always the same message. As an added incentive to whoever can help me: I need to get this stupid piece code working before I can send out the Illumination. (Well, that's assuming the person that helps me wants to read the Illumination.)

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
06-25-2007 at 01:43 AM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
Briareos
Level: Smitemaster
Avatar
Rank Points: 3516
Registered: 08-07-2005
IP: Logged
icon Re: PHP fsockopen question. (+3)  
ErikH2000 wrote:
It fails with the following value in $errstr: Failed to parse address "127.0.0.1"
Combing through the PHP source code shows that this error message is returned when PHP's own funky "parse_ip_address_ex" C function can't find a colon to separate IP and port number in the textual address it is passed.

Obviously, something funky is going on that prevents port from being appended to your "127.0.0.1", which would be something fsockopen does at the very beginning... perhaps try just using

fsockopen("127.0.0.1:25")

for a start.

Are you running your own installation of PHP, or is it one supplied by your ISP? I'd have the nagging suspicion that in the latter case someone might have added code to prohibit connections to port 25 at the lowest level possible, for fear of bad PHP code being misused to send out spam mail...

EDIT: if this is about sending mail from this very host, maybe have a look at what Schik is using to send mail - I'd hazard a guess it's PHP's bog-standard mail() function.

____________________________
"I'm not anti-anything, I'm anti-everything, it fits better." - Sole
R.I.P. Robert Feldhoff (1962-2009) :(

[Last edited by Briareos at 06-25-2007 11:47 AM]
06-25-2007 at 11:43 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: PHP fsockopen question. (+1)  
Briareos wrote:
Combing through the PHP source code shows that this error message is returned when PHP's own funky "parse_ip_address_ex" C function can't find a colon to separate IP and port number in the textual address it is passed.
Oh, that just makes me angry. It works to add in a ":25", but why the !@#$ should it? There is a separate parameter for port# and the PHP documentation doesn't mention any need to add the port#.
Are you running your own installation of PHP, or is it one supplied by your ISP? I'd have the nagging suspicion that in the latter case someone might have added code to prohibit connections to port 25 at the lowest level possible, for fear of bad PHP code being misused to send out spam mail...
There might be some non-standard version of PHP, but I guess I'm doubtful that someone wrote code here to prevent spam mail. We've sent bulk mail using the regular PHP mail() function, for example. Also, the port# I was using was actually 9025, but I had a moment of irrational paranoia about revealing it and substituted 25.
EDIT: if this is about sending mail from this very host, maybe have a look at what Schik is using to send mail - I'd hazard a guess it's PHP's bog-standard mail() function.
We have to deliver to a remote SMTP server as part of our new mail setup designed to prevent getting our site shut down for perceived spamming activity. Unfortunately, the PHP mail() function on Unix doesn't allow use of sockets to connect to a remote SMTP server. It's limited to a local connection through command-line (or maybe it was pipes or something like that, but no sockets).

The good news is that now that you dug into the source code and figured that out for me, I can probably get my mailing code working. The bad news is I have to go to work now.

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
06-25-2007 at 05:31 PM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: PHP fsockopen question. (0)  
I forgot to say...

Thanks for digging up that answer for me. You checked the PHP source code--wow!

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
06-25-2007 at 08:35 PM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
Briareos
Level: Smitemaster
Avatar
Rank Points: 3516
Registered: 08-07-2005
IP: Logged
icon Re: PHP fsockopen question. (0)  
ErikH2000 wrote:
Thanks for digging up that answer for me. You checked the PHP source code--wow!
:D

Heh... well, hacking away at ffdshow is quite a good exercise at making sense of huge amounts of code... :)

Of course, working for 11 hours straight like I did today to get our new intranet site ready for it's presentation tomorrow is less desirable, but only happens once in a blue moon... *phew*

And, after all, we can now look forward to a new illumination in the near future - so what I did was probably motivated by pure selfishness... ;)

EDIT: Also, it was less "checking" and more "grepping" the PHP source code...

np: The Orb - Jam On Your Honey (Orbsessions Volume 2)

____________________________
"I'm not anti-anything, I'm anti-everything, it fits better." - Sole
R.I.P. Robert Feldhoff (1962-2009) :(

[Last edited by Briareos at 06-25-2007 08:52 PM]
06-25-2007 at 08:51 PM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: PHP fsockopen question. (+2)  
Alright, I got it all working finally. You won't believe how complex delivering e-mail has become for us. When you do something that makes the Caravel website send an e-mail, like requesting a download link, here is what happens:

* The e-mail message is stored in a database queue with all the parts needed to send the message later.
* A background process grabs messages from the database queue taking into account their assigned priority, when they entered the queue, and the last time an e-mail message was sent to the same server. The main thing this logic does is keep us from sending a 1000 e-mails to Hotmail at one time and getting ourselve's blocked for future mail.
* The background process connects to a remote SMTP server that is hosted by benevolent DROD patron, Jamie Jones. This connection is made through a private SSH tunnel between the two servers. We don't want the hosting provider noticing hefty chunkloads of SMTP traffic between servers and then misclassifying us as spammers. (This happened once about three years ago.)

The new mail gets delivered from "caravelgames3.com" because we don't want the name host provider for "caravelgames.com" noticing hefty chunkloads of MX and SPF lookups against the same domain name that our webhosting is on and shutting down our website. (This happened once this year.) We are actually using separate name hosting companies to insulate the website from any bad attention given to Jamie's bulk-mailing server.

Between myself, Jamie, and Schik, we've devoted hundreds of hours to solving the problem of delivering large amounts of mail to people that actually asked to receive it.

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
06-26-2007 at 01:49 AM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
NiroZ
Level: Smitemaster
Rank Points: 1302
Registered: 02-12-2006
IP: Logged
icon Re: PHP fsockopen question. (0)  
Who would have guessed that emailing could become so complicated. Guess it's one more reason to hate spammers.
06-26-2007 at 06:11 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Jatopian
Level: Smitemaster
Rank Points: 1842
Registered: 07-31-2005
IP: Logged
icon Re: PHP fsockopen question. (+1)  
Does this mean Erik might finally look at my email?

____________________________
DROD has some really great music.
Make your pressure plates 3.0 style!
DROD architecture idea generator
06-26-2007 at 06:00 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Dolan42
Level: Master Delver
Avatar
Rank Points: 195
Registered: 04-14-2006
IP: Logged
icon Re: PHP fsockopen question. (0)  
ErikH2000 wrote:
As an added incentive to whoever can help me: I need to get this stupid piece code working before I can send out the Illumination. (Well, that's assuming the person that helps me wants to read the Illumination.)

-Erik
I just got a PM notification. :)
So where is the Illumination? ;)

____________________________
-D
"To understand recursion you must first understand recursion."
06-29-2007 at 07:01 AM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : PHP fsockopen question.
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.