sockets

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
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

sockets

Post by pelegk2 »

i want to use sockets to login to a server and query the server.
i have managed to establish a connection and to send and recive answer.
what do i need to do if i want to send data and recive data more then one time wihtought closing the session?
(i will close the session at the end of the process).


Thanks
Peleg
crazycoders
Forum Contributor
Posts: 260
Joined: Tue Oct 28, 2008 7:48 am
Location: Montreal, Qc, Canada

Re: sockets

Post by crazycoders »

Not possible unless the protocol supports it.
HTTP doesn't support keeping connection opened, you have to close and reopen to request new information!
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Re: sockets

Post by pelegk2 »

you mean that in the same page if i send a message to a socket and recive and answer i cant send again another message??
crazycoders
Forum Contributor
Posts: 260
Joined: Tue Oct 28, 2008 7:48 am
Location: Montreal, Qc, Canada

Re: sockets

Post by crazycoders »

No, it's not a socket issue, it's a protocol issue...

If the protocol you use is made to receive more messages such as an FTP control connection, then you can send many messages, but HTTP is a one way one receive thats all!

So you gotta close the socket and reconnect, but you can reopen one in the same PHP page to do more requests... that is not limited....
Post Reply