Sockets

Grant Edwards grante at visi.com
Thu Oct 11 23:35:04 EDT 2001


On Thu, 11 Oct 2001 16:28:25 GMT, Joseph A Knapka <jknapka at earthlink.net> wrote:

>> My problem is : what i put in ???????????????
>> Some people told me to use a delimeter betwen the 2 strings.
>> But how can i use it? How to decode the whole string ?
>
>There are a couple of approaches you could take. The
>first would be to use a delimiter, and continue to
>read until you see the delimiter, saving any additional
>data for further reads:
>
>delim = '!'

Choosing a delimiter is tricky, since it means that character
is no longer allowed to appear in any strings.  The most often
chosen options would be LF, CR/LF, or whitespace.  If you use
LF or CR/LF, then you can just call readline() and get the next
string.

When designing an application protocol to run on top of TCP, it
can be very handy to keep it in readable ASCII with CR/LF
delimited lines (e.g. SMTP, IMAP, POP, NNTP, ...)

-- 
Grant Edwards                   grante             Yow!  O.K.! Speak with a
                                  at               PHILADELPHIA ACCENT!! Send
                               visi.com            out for CHINESE FOOD!! Hop
                                                   a JET!



More information about the Python-list mailing list