Page 1 of 1

sockets

Posted: Fri May 15, 2009 1:47 pm
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

Re: sockets

Posted: Fri May 15, 2009 2:08 pm
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!

Re: sockets

Posted: Fri May 15, 2009 2:26 pm
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??

Re: sockets

Posted: Fri May 15, 2009 3:01 pm
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....