Asheeown Posted October 21, 2008 Share Posted October 21, 2008 When connected with a socket connection to a server is it limited or does it display the full session everytime you call for it? For example I'm connected to a server and I call the data at 20 lines but in between the next call 300 more lines of data come in, will it get all 320 lines the next time or is it limited to say 200 lines? Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/ Share on other sites More sharing options...
Asheeown Posted October 22, 2008 Author Share Posted October 22, 2008 Bump? Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-671348 Share on other sites More sharing options...
Asheeown Posted October 22, 2008 Author Share Posted October 22, 2008 Bump, I guess, just a simple question Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-672147 Share on other sites More sharing options...
DarkWater Posted October 22, 2008 Share Posted October 22, 2008 Can you elaborate more? You lost me at 'call the data at 20 lines'. Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-672153 Share on other sites More sharing options...
Asheeown Posted October 22, 2008 Author Share Posted October 22, 2008 An fgets command pulls data from a socket connection, is their any limit to the amount of data fgets can receive or does it always get 100% of what the socket connection can produce? Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-672192 Share on other sites More sharing options...
DarkWater Posted October 22, 2008 Share Posted October 22, 2008 You have fsockopen() in the title, so you confused me. I thought you meant fgets, but I wasn't sure. Since fgets() stops at a newline, I'd suggest using fread(): $data = fread($socket, 8192); Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-672201 Share on other sites More sharing options...
Asheeown Posted October 22, 2008 Author Share Posted October 22, 2008 And that will pull all data in the connection no matter how big? Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-672210 Share on other sites More sharing options...
DarkWater Posted October 22, 2008 Share Posted October 22, 2008 It'll read the first 8192 bytes. You might be able to get away with using feof() in a loop... while (!feof($socket)) { $data[] = fread($socket, 8192); } implode(chr(0x0A), $data); Link to comment https://forums.phpfreaks.com/topic/129482-solved-display-limit-for-fsocksopen/#findComment-672213 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.