[Sussex] Setting up a socket - PHP/Fedora

Brendan Whelan b_whelan at mistral.co.uk
Tue Sep 13 14:05:54 UTC 2005


Hi Ronan,

Thank you very much for your detailed response and offer of further help.

I have played around with the edited versions you sent me and things have
improved.
I have adapted the code to be nearer my final goal. The server now sits in a
loop awaiting requests from the client. When it receives a request it then
sends a reply. The client simply sends one message and awaits a reply.

There are two problems:

1. The server happily waits until it receives a request/message from the
client but no actual text is received (obviously something is received as
the server waits until it is triggered by the message from the client.)

2. The server doesn't wait for the next request but simply goes around the
loop i.e. the socket_read is always set after receiving the first message.
As a consequence the client only receives on, long, message.

Regards,

Brendan
----------------------------------------------------------------------------
----------
Messages returned:
Messages on server:

Create Socket

Bind

Listen

Waiting in loop 1<br>

Message received was ><>< - send a reply<br>

Message to be returned is >Thanks from server 1<<br>

Return message of >Thanks from server 1< sent<br>

Waiting in loop 2<br>

Message received was ><>< - send a reply<br>

Message to be returned is >Thanks from server 2<<br>

Return message of >Thanks from server 2< sent<br>

Waiting in loop 3<br>

Message received was ><>< - send a reply<br>

Message to be returned is >Thanks from server 3<<br>

Return message of >Thanks from server 3< sent<br>

------------------------------------

Messages on client

Sending server:Request from sender

Got message >Thanks from server 1Thanks from server 2Thanks from server 3<
from server

End of send message


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_socket_2.php
Type: application/octet-stream
Size: 1388 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20050913/a1050ed0/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_send_message_2.php
Type: application/octet-stream
Size: 599 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20050913/a1050ed0/attachment-0001.obj 


More information about the Sussex mailing list