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? Quote Link to comment Share on other sites More sharing options...
Asheeown Posted October 22, 2008 Author Share Posted October 22, 2008 Bump? Quote Link to comment 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 Quote Link to comment 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'. Quote Link to comment 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? Quote Link to comment 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); Quote Link to comment 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? Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.