Jump to content

socket read and write in the same time.


alin19

Recommended Posts

i have this part of my code that reads from the server, if there is something output by the server and then write,

the problem is that if there is nothing to read he waits until something is there, and only after that he try to write.

 

how can i do that he tryes to read and write in the same time,?

 

 

while (true)
{

if (false === ($line = socket_read($sock,10000))) 
            echo "socket_read() failed: reason: " . socket_strerror(socket_last_error($msgsock)) . "\n";
else	

{
        echo $line;
        }
         
        if (socket_write($sock, $order)) 
					echo "sa facut trimiterea de ordin";
					else 
					{
					echo "a aparut eroare la trimitere ordin";
					}
      }

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/124443-socket-read-and-write-in-the-same-time/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.