vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   "fsockopen" - Does Nothing for Me (https://vborg.vbsupport.ru/showthread.php?t=57118)

D3VIANCE 09-15-2003 08:43 PM

"fsockopen" - Does Nothing for Me
 
Please help! I'm not a coding n00b - not by any stretch. On the other hand, I'm not an expert with sockets. I've tried the most basic of examples, and still nothing. I can't connect to anything, even my own machine.

I'm simply trying to query a game server with the fsockopen command. Here's an example of a Jolt server that's always on:


PHP Code:

<?php
$fp 
fsockopen("udp://195.149.21.46"28950$errno$errstr);
if (!
$fp) {
    echo 
"ERROR: $errno - $errstr<br>\n";
} else {
    
fwrite($fp,"\n");
    echo 
fread($fp26);
    
fclose($fp);
}
?>

So what's wrong with this picture? Why will it not do anything?

Here it is, running on my server. It's an expensive server with 1&1 Hosting, Professional package:

http://www.clanplay.com/fsockopen.php

See? Times out. Does chuff all. Please help me! I'm running leagues, ladders, you name it on Clanplay, and I'm trying to develop a ranking system for SoF - but I can't even get past stage 1.

There's a big kiss in it for the first person who can get server queries working on my server. https://vborg.vbsupport.ru/

By the way, fsockopen isn't disabled. Here's a link to my phpinfo.php:

CLICK HERE

D3VIANCE 09-15-2003 10:25 PM

Okay, I've made advances. It is NOT "fsockopen" that is hanging, but "fread"!!! This code works fine:


PHP Code:

<?php
$host 
'udp://195.149.21.46';
$port 28950;
$fp fsockopen($host$port, &$err_no, &$err_msg10)
    or die (
"Could not open a socket connection to host <i>$host</i> on port <i>$port</i>.
        The error message returned was '<i>
$err_msg</i>'.");
echo 
"A socket connection to host <i>$host</i> on port <i>$port</i> was successfully opened.";
?>

http://www.clanplay.com/fsockopen-udp.php

I can run that all day long. However, as soon as I add the "fread" command I'm completely buggered.

Well, it's not much good being able to open a port unless you can read something from it. Even if I could just grab the first few bytes I'd break open a bottle of champagne, I swear to God...

Any ideas?


All times are GMT. The time now is 05:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01079 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete