Client (AS3) - Server (Python), policyrequest problem

I’m trying to solve this problem whole two days and I didnt find a solution yet, so i have to make new thread.

The problem is that when I run my SWF file on localhost it doesnt connect to server which is also on localhost, it outputs security error 2048. When i run this directly from Adobe Flash CS4 it works fine.
I’ve tried to get request from client on port 843 on server, but it seems client doesn connect there.

Here is client code (important part):


    public class CConnectionControl extends Sprite {
        private var hostName:String = "localhost";
        private var port:uint = 2000;
        private var socket:XMLSocket;

        public function CConnectionControl() {
            socket = new XMLSocket();
            configureListeners(socket);
            socket.connect(hostName, port);
        }

Server code:



import socket, sys

class cServer:

    client_sockets = []
    listen = 0
    listen2 = 0
    
    def __init__(self):    
        self.listen = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        port = int(2000)
        self.listen.bind(('', port))
        self.listen.listen(5)
        self.listen.setblocking(0)
        self.listen2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        port2 = int(843)
        self.listen2.bind(('', port2))
        self.listen2.listen(5)
        self.listen2.setblocking(0)
        print 'Server is listening'

    def Accepting(self):
        try:
            (client_socket,client_info) = self.listen2.accept()
            print 'policy file request'
        except: pass

print ‘policy file request’ - this print never happened.

I have no idea why is this happening