Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-31-2006
EmmanuelOga EmmanuelOga is offline
Registered User
 
 
Join Date: Jul 2006
Posts: 6
Ip Addresses and basic conection questions

Hello, i'm very new to ICE an also to network applications, so i have a couple of questions and i hope you can help me (and maybe point me to the proper manual pages, since i haven't yet found the answer to these questions).

1) Ice::ObjectPrx base= ic->stringToProxy("SimplePrinter:default -p 10000");

What ip address is being addressed here? Is it only localhost port 10.000? How can i connect specifically to, say, 192.168.0.165???

I think "SimplePrinter" here is an abstraction for an endpoint (ip address?), is it right?

2) In the server, how can i get the ip address of the machine that is using a servant object?

3) I need to do a chat-like program that's going to work on a class C lan (PC addreses 192.168.0.x) How can i implement clients that auto-discover the servers on my lan?

(for example, on start-up clients offers me a list of servers that he found on the lan)

Thank you very much!

P.D.: signature added

Last edited by EmmanuelOga : 07-31-2006 at 03:38 PM.
Reply With Quote
  #2 (permalink)  
Old 07-31-2006
beagles's Avatar
beagles beagles is offline
ZeroC Staff
 
Name: Brent Eagles
Organization: ZeroC, Inc
Project: Ice Developer
 
Join Date: Feb 2003
Location: Newfoundland
Posts: 110
Please fill out your signature with the information specified in our forum support policy.

Cheers
Reply With Quote
  #3 (permalink)  
Old 07-31-2006
EmmanuelOga EmmanuelOga is offline
Registered User
 
 
Join Date: Jul 2006
Posts: 6
Signature addition done!
__________________
Emmanuel Oga
Q4 Technologies Argentina (www.q4tech.com)
Q4Social Network (Internal lan messenger/file transfer app)
Reply With Quote
  #4 (permalink)  
Old 07-31-2006
beagles's Avatar
beagles beagles is offline
ZeroC Staff
 
Name: Brent Eagles
Organization: ZeroC, Inc
Project: Ice Developer
 
Join Date: Feb 2003
Location: Newfoundland
Posts: 110
Quote:
Originally Posted by EmmanuelOga
1) Ice::ObjectPrx base= ic->stringToProxy("SimplePrinter:default -p 10000");

What ip address is being addressed here? Is it only localhost port 10.000? How can i connect specifically to, say, 192.168.0.165???

I think "SimplePrinter" here is an abstraction for an endpoint (ip address?), is it right?
"SimplePrinter" is the Ice object identity. "default" indicates that the 'default' protocol should be used. The host address can be specified using the -h option. e.g.:

"SimplePrinter:default -h 192.168.0.165 -p 10000"

would means something like "create a proxy for an object whose identity is 'SimplePrinter' which can be communicated with via the host with the IP address 192.168.0.165 using port 10000 and the default protocol for the communicator 'ic'".

The Ice documentation describes Ice proxies in detail (including this specific example). I recommend giving it a good read. It will give you a huge head start in getting your project off the ground.

Quote:
Originally Posted by EmmanuelOga

2) In the server, how can i get the ip address of the machine that is using a servant object?
Check out the Ice documentation on the Ice::Current object. It has a Ice::Connection member named 'con' that can be used to get this sort of information. You might also want to do a search on this in these forums to find discussions related to this topic.

Quote:
Originally Posted by EmmanuelOga

3) I need to do a chat-like program that's going to work on a class C lan (PC addreses 192.168.0.x) How can i implement clients that auto-discover the servers on my lan?
True "Auto-discovery" of services isn't available. Check out this thread for some relevant discussion.

Cheers
Reply With Quote
  #5 (permalink)  
Old 07-31-2006
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Hi Emmanuel,

Quote:
Originally Posted by EmmanuelOga
1) Ice::ObjectPrx base= ic->stringToProxy("SimplePrinter:default -p 10000");

What ip address is being addressed here? Is it only localhost port 10.000? How can i connect specifically to, say, 192.168.0.165???
When you omit the host name/IP from a TCP/SSL/UDP endpoint, you get the IP address corresponding to the hostname as returned by gethostname(). See Appendix D.2 in the Ice manual.

In order to get the desired host/IP address, just use -h, e.g.:
"SimplePrinter:default -h 192.168.0.165 -p 10000"

Quote:
I think "SimplePrinter" here is an abstraction for an endpoint (ip address?), is it right?
Not, it's the identity of the target object. The endpoint is the information after the ':'.

Quote:
2) In the server, how can i get the ip address of the machine that is using a servant object?
Ice does not provide such an API; however your OS probably does. If you don't specific an address or hostname when you create an Ice object adapter, this object adapter will listen on all interfaces on the host computer. See appendix D.2 for full details.

Quote:
3) I need to do a chat-like program that's going to work on a class C lan (PC addreses 192.168.0.x) How can i implement clients that auto-discover the servers on my lan?
(for example, on start-up clients offers me a list of servers that he found on the lan)
The simplest solution would be to run IceGrid in a well-know location (host, port) and register an object in each of your chat servers as "well-known" with IceGrid. Then your clients can retrieve the list of chat servers by querying the IceGrid registry.

Cheers,
Bernard
__________________
Bernard Normier
ZeroC, Inc.
Reply With Quote
  #6 (permalink)  
Old 07-31-2006
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Quote:
Originally Posted by bernard
When you omit the host name/IP from a TCP/SSL/UDP endpoint, you get the IP address corresponding to the hostname as returned by gethostname(). See Appendix D.2 in the Ice manual.
It turns out this changed between Ice 3.0.1 and Ice 3.1, and the manual was not updated .

The "Clients semantics" are now similar to the "server semantics", i.e. if you omit -h, your stringified proxy expands to a proxy with an endpoint for each local interface except loopback--except when loopback is the only interface.

This will be fixed in the next revision on the manual.

Cheers,
Bernard
__________________
Bernard Normier
ZeroC, Inc.
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
Multiple IP addresses mwilson Help Center 1 11-13-2006 03:10 PM
Using Ice in an environment with changing IP addresses hiasl Help Center 7 09-19-2005 06:36 AM
Visual Basic two-way communication with Java msciarra Help Center 3 12-01-2004 03:33 PM
IceBox Conection refused xdm Help Center 5 12-11-2003 02:19 PM
basic freeze problem salva Help Center 1 06-30-2003 07:14 PM


All times are GMT -4. The time now is 10:28 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.