<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> for example , to send a request, the first three bytes have to be ascii
> "STX"
> then there has to be  4 bytes that show the length of the message
> then the actual message
> then the last three bytes have to be "ENX"
>
> also all int variables must me unsigned long-int (32 bit).
>
> so here is what i need to know,
> 1 how do i make something in ascii bytes to send off to this server ?

Python strings are full 8-bit byte strings.  Whether you should retrict 
bytes to ASCII bytes only depends on the situation.  According to what you 
said above, the server wants the number in binary rather than as ascii 
digits.

Other than that, send "STX", the number, your message, and "ENX"

> 2 how can i make sure something is a 32bit unsigned long int. ?

Look at the struct and/or array modules.  I suspect that you may have to 
pay attention to whether the server want the binary in big or little endian 
format.

Terry Jan Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to