socket policy flash help

NighterNet darkneter at gmail.com
Sat Aug 1 17:34:57 CEST 2009


On Aug 1, 4:52 am, Piet van Oostrum <p... at cs.uu.nl> wrote:
> >>>>> NighterNet <darkne... at gmail.com> (N) wrote:
> >N> I need help on the policy to able to let access to user to the server
> >N> once the policy access is finish. I been trying to find a good
> >N> example, but I got no luck. Using python version 3.1.
> >N> Here the code I tested but it not working.
> >N> if str(buff) == str("b\'<policy-file-request/>\\x00\'"):
>
> What is buff supposed to contain here? I assume a byte sequence?
> Do you reaaly mean that buff[0] contains the byte 'b' and buff[1]
> contains a single quote? And the last byte also a single quote? And the
> four bytes with \ x 0 0 before that instead of a null byte? In total 29 bytes?
>
> Or did you mean just the 23 bytes long b'<policy-file-request/>\x00'?
>
> Maybe it should be if buff == b'<policy-file-request/>\x00':
>
> >N>                               print ('policy FOUND >>> sending...')
> >N>                               rawinput = str('<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>')
>
> The str here is unnecessary as you have already a string.
>
> >N>                               print (rawinput)
> >N>                               b = bytes ( ord(c) for c in rawinput)
>
> Why not
> b = b'<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>' ?
>
> >N>                               self.sockfd.send(b);
>
> --
> Piet van Oostrum <p... at cs.uu.nl>
> URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
> Private email: p... at vanoostrum.org


I try that method and flash socket is not getting the policy.

b = b'<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from
domain=\"*\" to-ports=\"*\" /></cross-domain-policy>'
self.sockfd.send(b);

server = socket.socket( socket.AF_INET, socket.SOCK_STREAM)

When it able to read the policy it send it but it fail to send to
flash some reason and send it again and then d/c.



More information about the Python-list mailing list