Sockets conversation

Steve Holden sholden at holdenweb.com
Mon Jan 14 10:37:22 EST 2002


"Hugo Martires" <hugomartires at hotmail.com> wrote ...
> I'm new prgramming sockets, and i started with python module "socket".
>
> Now i have a problem in comunicating:
>     My
>            server send data...
>                  client receive that data, process it and reply it...
>                            server accept that reply.
> The problem:
>             server wan't to send data again...
>                 client can not understand tha data and breaks the
> connection
>
> Did you understand ?
>
> I wan't to make a conversation but i don't know how can i continue it.
>
> Real life example:
>     server:  how are you today ?
>         client: fine, i went to the beach !!!
>             server: beach !!??
>     server: really ? and, how's the waves ?
>         client: not a big deal, it was flat
>
> Tanks for help (I really need it)

Hugo: it seems that the problem here is one of protocol. The reason for
using protocols is precisely to define rules for sepaking together. In your
example, how is the client supposed to know when the server is expecting a
response?

[In fact, in traditional terms the client and server relationships would
usually be the other way around, since usually the server is the one sitting
around waiting for clients to make requests].


Usually the applications protocol specifications make this clear. For
example, suppose the connecting system ends questions it's expecting a reply
to with a double question mark, and the connected-to system ends responses
with a full-stop. You might then see:

client: how are you today??
server: fine, I went to the beach.
client: beach?
client: and, how's the waves??
server: not a big deal, it was flat.

[Feel free to interchange the names "client" and "server" in the above].

The point is that the transport layer (TCP or UDP) protocols have no way to
explicitly indicate that the application componentds that use them have sent
all current data and are blocked awaiting a reply. So you must build this
knowledge into your application components somehow.

regards
 Steve
--
http://www.holdenweb.com/


--
http://www.holdenweb.com/







More information about the Python-list mailing list