Exemplo n.º 1
0
void ClientHandler::addClient(Ethernet *packet) {
    switch (packet->getEther_type()) {
    case ETHERTYPE_ARP: {
        ARP<Ethernet> arp(*packet);
        addClient(arp.getSha(), arp.getSpa(), (userMac.compare(arp.getSha().c_str())) ? false : true);
        addClient(arp.getTha(), arp.getTpa(), (userMac.compare(arp.getTha().c_str())) ? false : true);
        break;
    }
    case ETHERTYPE_IP: {
        IP<Ethernet> ip(*packet);
        addClient(ip.getEther_shost(), ip.getIpSrc(), (userMac.compare(ip.getEther_dhost().c_str())) ? false : true);
        addClient(ip.getEther_dhost(), ip.getIpDst(), (userMac.compare(ip.getEther_shost().c_str())) ? false : true);
        break;
    }
    case ETHERTYPE_IPV6: {
        IPV6<Ethernet> ipv6(*packet);
        addClient(ipv6.getEther_shost(), ipv6.getIp6Src(), (userMac.compare(ipv6.getEther_dhost().c_str())) ? false : true);
        addClient(ipv6.getEther_dhost(), ipv6.getIp6Dest(), (userMac.compare(ipv6.getEther_shost().c_str())) ? false : true);
        break;
    }
    default: {
        addClient(packet->getEther_shost(), (userMac.compare(packet->getEther_dhost().c_str())) ? false : true);
        addClient(packet->getEther_dhost(), (userMac.compare(packet->getEther_shost().c_str())) ? false : true);
        break;
    }
    }
}
Exemplo n.º 2
0
void GamePair::initialize(GameSettingsPtr settings, const Vector<string> &levelCode, S32 clientCount)
{
   settings->resolveDirs();

   // Need to start Lua before we add any clients.  Might as well do it now.
   LuaScriptRunner::startLua(settings->getFolderManager()->getLuaDir());

   LevelSourcePtr levelSource = LevelSourcePtr(new StringLevelSource(levelCode));
   initHosting(settings, levelSource, true, false);      // Creates a game and adds it to GameManager

   server = GameManager::getServerGame();                // Get the game created in initHosting

   // Give the host name something meaningful... in this case the name of the test
   if(::testing::UnitTest::GetInstance()->current_test_case())
   {
      const char *name = ::testing::UnitTest::GetInstance()->current_test_case()->name();
      const char *name2 = ::testing::UnitTest::GetInstance()->current_test_info()->name();
      server->getSettings()->setHostName(string(name) + "_" + name2, false);
   }

   server->startHosting();          // This will load levels and wipe out any teams

   for(S32 i = 0; i < clientCount; i++)
      addClient("TestPlayer" + itos(i));

   idle(1, 5);    // Give GameType and game objects time to propagate to client(s)
}
Exemplo n.º 3
0
void ZServer::threadProcAccept()
{
    sockaddr_in  address;
    int len = 0;
    while(isRunning())
    {
        memset(&address, 0, sizeof(address));
        len = sizeof(address);

        SOCKET socket = ::accept(m_socket, (sockaddr*)&address, &len);    
        if(socket == SOCKET_ERROR)
        {
            printf("接收新连接失败:%d\n", GetLastError());
            continue;
        }

        printf("接收到来自[%s:%d]的连接-socket[%d]\n",
            inet_ntoa(address.sin_addr),
            htons(address.sin_port),
            socket);

        ZClientNodePtr ptr = new ZClientNode(this, socket, inet_ntoa(address.sin_addr), address.sin_port);
        addClient(ptr);       
        std::cout<<"创建连接:"<<ptr->id()<<std::endl;

        checkDead();
    }

}
Exemplo n.º 4
0
void *eventAcceptThreadFunc(void *arg) {
  int clifd;
  fd_set acceptset;

  dbg_clear(DBG_SIM, "SIM: eventAcceptThread running.\n");

  while (1) {
    FD_ZERO(&acceptset);
    FD_SET(eventServerSocket, &acceptset);
    EC_DEBUG(fprintf(stderr, "SIM: eventAcceptThread: calling select\n"));
    if (select(eventServerSocket + 1, &acceptset, NULL, NULL, NULL) < 0) {
      EC_DEBUG(fprintf(stderr, "SIM: eventAcceptThreadFunc: error in select(): %s\n", strerror(errno)));
    }
    EC_DEBUG(fprintf(stderr, "SIM: eventAcceptThread: select returned\n"));

    if (FD_ISSET(eventServerSocket, &acceptset)) {
      EC_DEBUG(fprintf(stderr, "SIM: eventAcceptThread: Checking for event connection\n"));
      clifd = acceptConnection(eventServerSocket);
      EC_DEBUG(fprintf(stderr, "SIM: eventAcceptThread: Got event connection %d\n", clifd));
      pthread_mutex_lock(&eventClientsLock);
      addClient(eventClients, clifd);
      sendInitEvent(clifd);
      pthread_cond_broadcast(&eventClientsCond);
      pthread_mutex_unlock(&eventClientsLock);
    }
  }
  return 0;
}
Exemplo n.º 5
0
void    Server::checkFds()
{
  std::vector<Client *>::iterator it = clients.begin();
  std::vector<std::vector<Client *>::iterator>    itList;

  while (it != clients.end())
    {
      if (FD_ISSET((*it)->getFd(), &fdRead) && (*it)->receiveData() == false)
    	{
    	  itList.push_back(it);
    	  std::cout << "Client left" << std::endl;
    	}
      else if (FD_ISSET((*it)->getFd(), &fdWrite))
      {
        (*it)->sendData();
      }
      ++it;
    }
  for (unsigned int i = 0; i < itList.size(); ++i)
  {
    for (unsigned int j=0; j < clients.size(); ++j)
      if (clients[j]->getUsername() != (*itList[i])->getUsername())
      {
        std::cout << "deleting" << std::endl;
        Identity resp((*itList[i])->getUsername(), DELCONTACT);
        Packet *t = new Packet(resp);
        clients[j]->addPacketToSend(t);
      }
    clients.erase(itList[i]);
  }
  if (FD_ISSET(fd, &fdRead))
    addClient();
}
Exemplo n.º 6
0
void ChatServer::run() {
	while (true) {
		vector<struct pollfd>* fds = _getPollFds();
		int revents = poll(fds->data(), fds->size(), -1);
		int handled = 0;
		for (vector<struct pollfd>::iterator i = fds->begin();
				i != fds->end() && handled < revents;
				++i) {
			if (i->revents != 0) {
				++handled;
				if (i->fd == _server->getFd()) {
					// cout << "add new client" << endl;
					addClient(accept(_server->getFd(), NULL, NULL));
				} else {
					Client* c = _clients[i->fd];
					if (c->readNext() == false) {
						remClient(c->getSocket()->getFd());
						// cout << "removed old client" << endl;
					} else {
						Command* cmd = c->getCommand();
						if (cmd != NULL) {
							// cout << "execute command" << endl;
							cmd->execute(this);
						}
					}
				}
			}
		}
		delete fds;
	}
}
Exemplo n.º 7
0
void connectTo(Command* com) {
	char * ip = com->args[0];
	int port = atoi(com->args[1]);
	Client client = connectToIp(ip, port);
	addClient(client);
	FD_SET(client.fd, &g_fdsets);
}
Exemplo n.º 8
0
void DataBus::Server::newClientConnected()
{
    while (m_tcpServer.hasPendingConnections())
    {
        // Initialize new DataBus Client
        QTcpSocket *socket = m_tcpServer.nextPendingConnection();
        Client *client = new Client(this);

        if (client->initialize(socket) == false)
        {
            // Error, failed to initialize socsocketket
            if (socket != 0)
            {
                socket->close();
                socket->deleteLater();
                socket = 0;
            }

            continue;
        }

        connect(client, SIGNAL(clientDisconnected(Client*)), this, SLOT(clientDisconnected(Client*)));
        connect(client, SIGNAL(newPacketReceived(Client*)), this, SLOT(processReceivedPacket(Client*)));

        // Add client to list
        addClient(client);
    }
}
Exemplo n.º 9
0
void mainMenu(Client *clients, Worker *workers, Order *orders, Product *products,
        int *clientCount, int *workerCount, int *orderCount, int *productCount) {
    int op;
    do {
        mainMenuPrint();
        readInt(&op, MENU_OPT_MIN, MENU_OPT_MAX, MENU_MSG_OPT);
        switch (op) {
            case 0: //exit
                cleanScreen();
                printf("MSG DESPEDIDA\n");
                break;
            case 1: //Register Client
                cleanScreen();
                addClient(clients, clientCount);
                break;
            case 2: //Login Client
                cleanScreen();
                clientMenu(clients, orders, products, clientCount, orderCount, productCount);
                break;
            case 3: //Manag Worker
                cleanScreen();
                manageMenu(clients, workers, orders, products, clientCount, workerCount, orderCount, productCount);
                break;
            default:
                printf(MENU_MSG_OPT_INVALID);
        }
    } while (op != 0);
}
Exemplo n.º 10
0
void FTPServer::clientMessage(MessageType type, int sessionID, QString message)
{
    QString id = QString::number(sessionID);
    switch(type)
    {
    case DataReceived:
        emit logMessage(id + " Data recived: " + message.trimmed());
        break;

    case DataSent:
        emit logMessage(id + " Data sent: " + message.trimmed());
        break;

    case Error:
        emit logMessage(id +  " Error: " + message.trimmed());
        break;

    case Connected:
    {
        FTPClient *client = qobject_cast<FTPClient*>(sender());
        if(client)
            addClient(sessionID, client);
        break;
    }

    case Disconnected:
        removeClient(sessionID);
        break;

    default:
        emit logMessage(id + " " + message.trimmed());
    }
}
Exemplo n.º 11
0
bool Epoll::wait(){
	while(serviceFlag)
	{
		int num = epoll_wait(_epfd, _events, EPOLL_SIZE, EPOLL_RUN_TIMEOUT);
		for(int i = 0; i < num ; i++)
		{
			if(_events[i].data.fd == _server->getFileDescripto())                    //新的连接到来,将连接添加到epoll中,并发送欢迎消息
			{
				Client* client = new Client();
				if (!client->connect(_server->getFileDescripto())) {
					continue;
				}
				addClient(client);
				_evt.data.fd = client->getFileDescripto();
				epoll_ctl(_epfd, EPOLL_CTL_ADD, client->getFileDescripto(), &_evt);
			}
			else  // 有消息需要读取
			{
				handle(_events[i].data.fd); //注意:这里并没有调用epoll_ctl重新设置socket的事件类型,但还是可以继续收到客户端发送过来的信息
			}
		}
		
	}
	_server->shut();
	::close(_epfd);
	return true;
}
Exemplo n.º 12
0
void mainWindow::makeConnections()
{
	QObject::connect(actionAbout, SIGNAL( triggered() ), this, SLOT( show_aboutDialog() ) );
	QObject::connect(actionPreferences, SIGNAL( triggered() ), this, SLOT( show_preferences() ) );
	QObject::connect(actionStart, SIGNAL( triggered() ), this, SLOT( startFolding() ) );
	QObject::connect(actionStop, SIGNAL( triggered() ), this, SLOT( stopFolding() ) );
	QObject::connect(actionHomepage, SIGNAL( triggered() ), this, SLOT( loadHomepage() ) );
	QObject::connect(actionSourceForge, SIGNAL( triggered() ), this, SLOT( loadSourceForge() ) );
	QObject::connect(actionFoldingWebsite, SIGNAL( triggered() ), this, SLOT( loadFoldingWebsite() ) );
	QObject::connect(actionFoldingForum, SIGNAL( triggered() ), this, SLOT( loadFoldingForum() ) );
	QObject::connect(actionContact, SIGNAL( triggered() ), this, SLOT( contactAuthor() ) );
	QObject::connect(actionAddClient, SIGNAL( triggered() ), this, SLOT( addClient() ) );
	QObject::connect(actionRemoveClient, SIGNAL( triggered() ), this, SLOT( removeClient() ) );
	QObject::connect(actionSaveConfig, SIGNAL( triggered() ), this, SLOT( saveConfig() ) );
	QObject::connect(actionPersonalStats, SIGNAL( triggered() ), this, SLOT( reloadPersonalStats() ) );
	QObject::connect(actionTeamStats, SIGNAL( triggered() ), this, SLOT( reloadTeamStats() ) );
	QObject::connect(actionMoleculeViewer, SIGNAL( triggered() ), this, SLOT( showMolecule() ) );
	QObject::connect(actionExit, SIGNAL(triggered()), this, SLOT(checkExit()));

	
	QObject::connect(clients->table, SIGNAL( cellClicked( int, int) ), this, SLOT( showInfo()));
	
	Reloader = new QTimer(this);
    	connect(Reloader, SIGNAL(timeout()), this, SLOT(reloadClients()));
    	Reloader->start(60000);
}
/*
 * Set the given sockets to the socket list to be listen on
 */
void MultipleClientSocketsListener::addClients(vector<Client*> clientVec)
{
	// set the given sockets as the socket list to selct from
	for (unsigned int i = 0; i < clientVec.size(); i++)
	{
		addClient(clientVec[i]);
	}
}
Exemplo n.º 14
0
Client * createClient(Resources & resource, int clientBandwidth, int clientPort){
	Client * newClient = new Client();
	newClient->bandwidth = clientBandwidth;
	newClient->port = clientPort;
	
	resource.remainingBandwidth -= clientBandwidth;
	return addClient(newClient);
}
Exemplo n.º 15
0
ClientGame *GamePair::addClientAndSetRole(const string &name, ClientInfo::ClientRole role)
{
   ClientGame *client = addClient(name);
   ClientInfo *clientInfo = server->findClientInfo(name);
   clientInfo->setRole(role);

   return client;
}
Exemplo n.º 16
0
void CGroupServer::incomingConnection(int socketDescriptor)
{
  getCommunicator()->sendLog("Incoming connection");
        // connect the client straight to the Communicator, as he handles all the state changes
        // data transfers and similar.
  CGroupClient *client = new CGroupClient(parent());
  addClient(client);

  client->setSocket(socketDescriptor);
}
Exemplo n.º 17
0
ClientSession::ClientSession(RemoteClient* master,
                             LocalClient* client,
                             id_type<Session> id,
                             QObject* parent):
    Session{client, id, parent},
    m_master{master}
{
    addClient(master);
    connect(master, &RemoteClient::messageReceived,
            this, &Session::validateMessage, Qt::QueuedConnection);
}
Exemplo n.º 18
0
ClientGame *GamePair::addClientAndSetTeam(const string &name, S32 teamIndex)
{
   ClientGame *clientGame = addClient(name);

   TNLAssert(teamIndex != NO_TEAM, "Invalid team!");
   TNLAssert(teamIndex < server->getTeamCount(), "Bad team!");

   ClientInfo *clientInfo = server->findClientInfo(name);
   server->getGameType()->changeClientTeam(clientInfo, teamIndex);

   return clientGame;
}
Exemplo n.º 19
0
// Simulates player joining game from new client
ClientGame *GamePair::addClient(const string &name)
{
   ClientGame *clientGame = newClientGame();
   clientGame->userEnteredLoginCredentials(name, "password", false);    // Simulates entry from NameEntryUserInterface

   // Get a base UI going, so if we enter the game, and exit again, we'll have a place to land
   clientGame->activateMainMenuUI();

   GameManager::addClientGame(clientGame);

   return addClient(clientGame);
}
Exemplo n.º 20
0
bool Daemon::init()
{
    mServer.newConnection().connect([this](SocketServer* server) {
            SocketClient::SharedPtr client;
            for (;;) {
                client = server->nextConnection();
                if (!client)
                    return;
                addClient(client);
            }
        });

    bool ok = false;
    for (int i=0; i<10; ++i) {
        warning() << "listening" << mOptions.localUnixPath;
        if (mServer.listen(mOptions.localUnixPath)) {
            ok = true;
            break;
        }
        if (!i) {
            enum { Timeout = 1000 };
            std::shared_ptr<Connection> connection = Connection::create(plast::ConnectionVersion);
            if (connection->connectUnix(mOptions.localUnixPath, Timeout)) {
                connection->send(QuitMessage());
                connection->disconnected().connect(std::bind([](){ EventLoop::eventLoop()->quit(); }));
                connection->finished().connect(std::bind([](){ EventLoop::eventLoop()->quit(); }));
                EventLoop::eventLoop()->exec(Timeout);
            }
            Path::rm(mOptions.localUnixPath);
        } else {
            sleep(1);
        }
    }

    if (!ok) {
        error() << "Unable to unix listen" << mOptions.localUnixPath;
        return false;
    }

    sInstance = shared_from_this();
    messages::init();
    mLocal.init();
    mRemote.init();

    mHostName.resize(sysconf(_SC_HOST_NAME_MAX));
    if (gethostname(mHostName.data(), mHostName.size()) == 0) {
        mHostName.resize(strlen(mHostName.constData()));
    } else {
        mHostName.clear();
    }

    return true;
}
Exemplo n.º 21
0
int main(int argc, char *argv[]){
	struct sockaddr_in cliaddr;
	char buf[MAXLINE+1];
	int i, j, nbyte, accp_sock, addrlen = sizeof(struct sockaddr_in);
	fd_set read_fds;

	if(argc != 2) {
		printf("사용법 : %s port\n", argv[0]);
		exit(0);
	}

	listen_sock = tcp_listen(INADDR_ANY, atoi(argv[1]), 5);
	while(1){
		FD_ZERO(&read_fds);
		FD_SET(listen_sock, &read_fds);
		for(i=0; i<num_chat; i++)
			FD_SET(clisock_list[i], &read_fds);
		maxfdp1 = getmax() + 1;
		puts("wait for client");
		if(select(maxfdp1, &read_fds, NULL, NULL, NULL)<0)
			errquit("select fail");

		if(FD_ISSET(listen_sock, &read_fds)){
			accp_sock=accept(listen_sock, (struct sockaddr*)&cliaddr, &addrlen);
			if(accp_sock == -1)
				errquit("accept fail");
			addClient(accp_sock, &cliaddr);
			send(accp_sock, START_STRING, strlen(START_STRING), 0);
			printf("%d번째 사용자 추가.\n", num_chat);
		}

		for(i=0; i<num_chat; i++){
			if(FD_ISSET(clisock_list[i], &read_fds)){
				nbyte = recv(clisock_list[i], buf, MAXLINE, 0);
				if(nbyte <=0){
					removeClient(i);
					continue;
				}
				buf[nbyte] = 0;
				if(strstr(buf, EXIT_STRING) != NULL) {
					removeClient(i);
					continue;
				}
				for(j=0; j<num_chat; j++)
					send(clisock_list[j], buf, nbyte, 0);
				printf("%s\n", buf);
			}
		}
	}
	return 0;
}
Exemplo n.º 22
0
void getOnlineList(DATA *data){
	int i;
	for(i=0;i<10;i++){
		if(peers[i]!=NULL){
			addClient(data, newClient(
					peers[i]->name,
					peers[i]->ip,
					peers[i]->port,
					peers[i]->nameLen
				));
			data->length += peers[i]->nameLen;
			data->length += (4+4+2);
		}
	}
}
Exemplo n.º 23
0
Image* CSSImageGeneratorValue::getImage(RenderObject* renderer, const IntSize& size)
{
    IntSize oldSize = m_clients.get(renderer);
    if (oldSize != size) {
        removeClient(renderer);
        addClient(renderer, size);
    }
    
    // Don't generate an image for empty sizes.
    if (size.isEmpty())
        return 0;
    
    // Look up the image in our cache.
    return m_images.get(size);
}
Exemplo n.º 24
0
MainPresenter::MainPresenter(IViewForm *view, QObject *perent)
    :QObject(perent), m_view(view)
{
    QObject* view_obj = dynamic_cast<QObject*>(m_view);
    QObject::connect(view_obj, SIGNAL(actionFindClient()),
            this, SLOT(findClients()));
    QObject::connect(view_obj, SIGNAL(actionAddClient()),
            this, SLOT(addClient()));
    QObject::connect(view_obj, SIGNAL(actionReturnIndex(const int)),
            this, SLOT(createClientWindow(const int)));
    QObject::connect(view_obj, SIGNAL(actionRemoveClient(const int)),
            this, SLOT(removeClient(const int)));

    dbManager = DataBaseManager::getInstance();

    findClients();

}
Exemplo n.º 25
0
void Server::start()
{
	int rslt;
	sockaddr_in client;//客户端地址结构
	int addrLen=sizeof(client);
	SOCKET clientSock;//客户端socket
	char buff[MAX_BUFFER_LEN];//UDP数据缓存
	while(true)
	{
		if(m_Protocaltype==TCP_DATA)//TCP数据
		{
			clientSock=accept(m_socket,(sockaddr*)&client,&addrLen);//接收请求
			if(clientSock==INVALID_SOCKET)
				break;
			if (clientSock==INVALID_SOCKET)
			{
				cout<<"TCP客户端接收请求失败!"<<endl;
			}
			assert(clientSock!=INVALID_SOCKET);
			sockaddr_in*pc=addClient(client);//添加一个客户端
			connect(pc);//连接处理函数
			SockParam sp(clientSock,pc,this);//参数结构
			HANDLE thread=CreateThread(NULL,0,threadProc,(LPVOID)&sp,0,NULL);//创建连接线程
			if (thread==NULL)
			{
				cout<<"创建连接线程失败!"<<endl;
			}
			assert(thread!=NULL);
			CloseHandle(thread);//关闭线程
			cout<<"TCP连接服务器成功";
		}
		else if(m_Protocaltype==UDP_DATA)//UDP数据
		{
			/*memset(buff,0,MAX_BUFFER_LEN);
			rslt=recvfrom(m_socket,buff,MAX_BUFFER_LEN,0,(sockaddr*)&client,&addrLen);
			assert(rslt>0);
			char resp[MAX_BUFFER_LEN]={0};//接收处理后的数据
			rslt=procRequest(&client,buff,rslt,resp);//处理请求
			rslt=sendto(m_socket,resp,rslt,0,(sockaddr*)&client,addrLen);//发送udp数据
			*/
		 
		}
	}
}
Exemplo n.º 26
0
void ServerAccessControlManager::removeClient( VncServerClient* client )
{
	m_clients.removeAll( client );

	// force all remaining clients to pass access control again as conditions might
	// have changed (e.g. AccessControlRule::ConditionAccessFromAlreadyConnectedUser)

	VncServerClientList previousClients = m_clients;
	m_clients.clear();

	for( auto client : previousClients )
	{
		if( addClient( client ) == false )
		{
			qDebug( "ServerAccessControlManager::removeClient(): closing connection as client does not pass access control any longer" );
			client->setProtocolState( VncServerClient::Close );
		}
	}
}
Exemplo n.º 27
0
Image* ImageBySizeCache::getImage(const RenderObject* renderer, const IntSize& size)
{
    RenderObjectSizeCountMap::iterator it = m_clients.find(renderer);
    ASSERT(it != m_clients.end());

    SizeCountPair& sizeCount = it->second;
    IntSize oldSize = sizeCount.first;
    if (oldSize != size) {
        removeClient(renderer);
        addClient(renderer, size);
    }

    // Don't generate an image for empty sizes.
    if (size.isEmpty())
        return 0;

    // Look up the image in our cache.
    return m_images.get(size).get();
}
DisplayRefreshMonitor* DisplayRefreshMonitorManager::createMonitorForClient(DisplayRefreshMonitorClient& client)
{
    PlatformDisplayID clientDisplayID = client.displayID();
    for (const RefPtr<DisplayRefreshMonitor>& monitor : m_monitors) {
        if (monitor->displayID() != clientDisplayID)
            continue;
        monitor->addClient(client);
        return monitor.get();
    }

    auto monitor = DisplayRefreshMonitor::create(client);
    if (!monitor)
        return nullptr;

    monitor->addClient(client);
    DisplayRefreshMonitor* result = monitor.get();
    m_monitors.append(WTFMove(monitor));
    return result;
}
Exemplo n.º 29
0
Image* CSSImageGeneratorValue::getImage(const LayoutObject* layoutObject, const IntSize& size)
{
    LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject);
    if (it != m_clients.end()) {
        SizeAndCount& sizeCount = it->value;
        IntSize oldSize = sizeCount.size;
        if (oldSize != size) {
            removeClient(layoutObject);
            addClient(layoutObject, size);
        }
    }

    // Don't generate an image for empty sizes.
    if (size.isEmpty())
        return nullptr;

    // Look up the image in our cache.
    return m_images.get(size);
}
Exemplo n.º 30
0
ConnectionManager::ConnectionManager(bool bModal)
        : ConnectionManagerBase(NULL, "manager", bModal)
{
    SET_WNDPROC("manager")
    setIcon(Pict("configure"));
    setButtonsPict(this);
    setCaption(caption());
    lstConnection->setHScrollBarMode(QScrollView::AlwaysOff);
    lstConnection->header()->hide();
    lstConnection->setSorting(1);
    fill();
    connect(btnAdd, SIGNAL(clicked()), this, SLOT(addClient()));
    connect(btnRemove, SIGNAL(clicked()), this, SLOT(removeClient()));
    connect(btnUp, SIGNAL(clicked()), this, SLOT(upClient()));
    connect(btnDown, SIGNAL(clicked()), this, SLOT(downClient()));
    connect(btnUpdate, SIGNAL(clicked()), this, SLOT(updateClient()));
    connect(lstConnection, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    m_bModal = bModal;
}