Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-11-2007
blade blade is offline
Registered User
 
Name: Antonio Verdino
Organization: University of Sannio (Italy)
Project: I use IceE for my thesis
 
Join Date: Aug 2007
Posts: 4
client ask a string to the server and the server send it to the client

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
Reply With Quote
  #2 (permalink)  
Old 08-12-2007
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 912
Code:
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.
Reply With Quote
  #3 (permalink)  
Old 08-13-2007
blade blade is offline
Registered User
 
Name: Antonio Verdino
Organization: University of Sannio (Italy)
Project: I use IceE for my thesis
 
Join Date: Aug 2007
Posts: 4
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.
Reply With Quote
  #4 (permalink)  
Old 08-13-2007
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,543
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.
Reply With Quote
  #5 (permalink)  
Old 08-13-2007
blade blade is offline
Registered User
 
Name: Antonio Verdino
Organization: University of Sannio (Italy)
Project: I use IceE for my thesis
 
Join Date: Aug 2007
Posts: 4
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!
Reply With Quote
  #6 (permalink)  
Old 08-13-2007
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 912
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:

Code:
::std::string ss = "Hello";
CString cs(ss.c_str());
// use cs...
Cheers,

Michi.
Reply With Quote
  #7 (permalink)  
Old 08-15-2007
blade blade is offline
Registered User
 
Name: Antonio Verdino
Organization: University of Sannio (Italy)
Project: I use IceE for my thesis
 
Join Date: Aug 2007
Posts: 4
ok, thanks
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
send an object client -> server arnaud Help Center 3 02-23-2006 08:29 PM
how can i make server send string to client jerry_cym Help Center 2 02-07-2006 05:46 AM
How server initiatively send message to client, and client can responce to it? ouloba Help Center 3 11-26-2004 10:35 AM
An error occurs when c# client send chinese string to c++ server ChaosXu Help Center 4 10-29-2004 08:12 AM
How to send data from server to client? kane Help Center 4 10-26-2004 09:33 AM


All times are GMT -4. The time now is 12:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.