sockets strings and fgets

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Guy
Forum Commoner
Posts: 53
Joined: Sun Jan 12, 2003 3:34 am

sockets strings and fgets

Post by Guy »

I'm using

Code: Select all

fgets($fp,256)
to get a string from a socket i opened before.
teh socket is sending a string of the length of 256 which from the end point of the actual data is filled with'\0'( end of string).
the problem is that the fgets never finish reading the string and get timed out.
how can i solve this (i want to get 256 chars but be able to get '\0' in them)
can it be done?
Guy
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Post Reply