QT and Ice Basic Application Error

tolga.tunatolga.tuna Member Tolga TUNAOrganization: SAVRONIKProject: QT File Transfer

Im trying to make basic (Hello world) TCP communication with ice on QT. I want to make a server which listens strings from client. Just that. I found some complex example (like chat demo but its very complex one and not for a beginner on ice). My problem is when i try to make communication, all program is closed with error.

Anyone has beginner example for qt? And send me please?
(My mail address : [email protected])

---Here is my work---

My Printer.ice file:

module Demo {
interface Printer {
void printString(string s);

My Maincpp Code: (RED Part which trys to start server and give error)

#include "mainserver.h"
#include "ui_mainserver.h"
#include <Printer.h>
#include <printeri.h>
#include <Ice/Application.h>
#include <QDebug>

class Server : public Ice::Application

virtual int run(int, char *[]);

int Server::run(int, char *[])
qDebug()<<"!!!Ice run is ok!!!";

Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("ASD");
qDebug()<<"Adapter declarataion";

Demo::PrinterPtr object = new PrinterI;
qDebug()<<"HelloPtr declarataion";

adapter->add(object, communicator()->stringToIdentity("ASD"));
qDebug()<<"ASD added to adapter";

qDebug()<<"Adapter activated";

qDebug()<<"Waiting for data";


MainServer::MainServer(QWidget *parent) :
ui(new Ui::MainServer)

Server app;
char * argv[1];


delete ui;

void MainServer::changelineedit(std::string STR)
QString str = QString::fromUtf8(STR.data(),STR.size());

My PrinterI.h Code:

#ifndef PRINTERI_H
#define PRINTERI_H

#include <Printer.h>
class PrinterI : public Demo::Printer
public :
virtual void printString(const std::string &, const Ice::Current &);

#endif // PRINTERI_H

My PrinterI.cpp code:

#include <IceUtil/IceUtil.h>
#include <Ice/Ice.h>
#include <printeri.h>
#include <mainserver.h>
#include <ui_mainserver.h>

using namespace std;

void PrinterI::printString(const string &gelenveri, const Ice::Current &)
MainServer *main;

What is the problem of that code? And why the app.main(argc,argv) makes error. And what is the argc and argv in there?

In the example i saw some config files. Is there any way to run that code with a config file. Is there any way to make communication with udp?
Sign In or Register to comment.