Archived
This forum has been archived. Please start a new discussion on GitHub.
client ask a string to the server and the server send it to the client
in Help Center
hello. I use IceE and C++. I have this problem: the client can to send a string to the server (this work well), and the client can to ask a string to the server and the server must send it to the client, how can make this?
the slice is:
module Configuration {
interface Printer{
void setConfiguration(string s);
string getConfiguration();
};
};
help me, please!
thanks
the slice is:
module Configuration {
interface Printer{
void setConfiguration(string s);
string getConfiguration();
};
};
help me, please!
thanks
0
Comments
-
string PrinterI::getConfiguration(const Ice::Current&) { return "Hello"; }
The above is probably close to what you want. I strongly recommend that you read the relevant C++ mapping chapters in the documentation, study the file system example in the doc, and have a good look at the various demos in the distribution. These will answer you questions.
Cheers,
Michi.0 -
thanks
ok, thanks, but my problem is that: the server and the client must send and get string. I must build for the client the Ice object and the proxy this is my problem. I must build a client but not pure client, the client is a server too.
thanks.0 -
Hi,
I would recommend to check the callback demo from your Ice distribution (located in the demo/Ice/callback directory). I believe it does what you're looking for. Let us know if you still have any questions after checking out this demo.
Cheers,
Benoit.0 -
that's all, work well now.
But I have another problem, I must use the MFC, how I can to make this:
...........
......
string st;
PrinterPrx printer = PrinterPrx::checkedCast(base);
if (!printer)
throw "Invalid proxy";
st=printer->getGeneral(); //get ther string of the server
AfxMessageBox(CString(st)); //the problem is here
..............
not possible converter std::string to CString
st get the string of the server, I must display the string in a messaggebox
how can I to make this???
this not a problem of ice, I know this, but I must to make this!
thanks
Sorry for my english, I not speak well in english!
0 -
I'm sorry, but we cannot answer questions that are not specific to Ice, such as on general C++ programming or Microsoft class libraries.
I suggest to check out the CString documentation and the STL reference. Before posting a question here, you should also make a reasonable effort to find the answer in the manual and the demos that ship with Ice.
I haven't tried this, but something like the following should work:::std::string ss = "Hello"; CString cs(ss.c_str()); // use cs...
Cheers,
Michi.0 -
ok, thanks
0