What is the preferred method for reading/writing to TCP/IP sockets in PHP? There are many, many ways of doing it, including:
fread()andfwrite()fgets()andfputs()file_get_contents()andfile_put_contents()stream_get_contents()stream_socket_recvfrom()andstream_socket_sendto()- probably several others that I've not run across...
I realize that fgets() and fputs() operate a bit differently (by lines instead of arbitrary chunks of data), but I really don't understand the differences in the others and which method would be best for what purposes.
Edit: Also socket_recv() and socket_send().
Edit #2: Also socket_read() and socket_write().