Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Peek into blocking sockets?

Posted on 2002-06-03
4
Medium Priority
?
914 Views
Last Modified: 2008-03-10
Is there a way to find out whether there is data waiting in the buffer of a blocking socket? I need to read out data if it's there, or don't if it's not. Problem with blocking sockets is that once you've begun a read operation, it does not return before that many bytes are actually read, which becomes a problem if those bytes never arrive, since your script just hangs.

I've tried socket_get_status(), which says that it returns the number of unread bytes in the socket buffer, but instead it always returns 0.

I've tried to set the sockets to non-blocking, but I don't really know how to use them that way.

Can anybody help?
0
Comment
Question by:nrico
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Accepted Solution

by:
mrvithan earned 800 total points
ID: 7064115
you might be looking for socket_select function; http://www.php.net/manual/en/function.socket-select.php

try it
0
 
LVL 11

Expert Comment

by:shmert
ID: 9643223
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept mrvithan
Please leave any comments here within the next seven days.
               
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question