Home Help Center

Address family not supported by protocol family

SukhiSukhi Member Sukhdeep SainiOrganization: UQProject: Developing context aware application for smartHome
Hi
My publisher runs successfully, but subscriber has the below error. It it due to IPv6 or usage of lower version of Jre like 1.6? Appreciate any kind of help.

at IceInternal.Network.doBind(Network.java:251)
at IceInternal.TcpAcceptor.<init>(TcpAcceptor.java:119)


Caused by: java.net.SocketException: Address family not supported by protocol family: bind
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at IceInternal.Network.doBind(Network.java:245)

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Seems that your subscriber is running on a platform that doesn't support IPv6(i guess that is Windows XP + Java), you can disable IPv6 by setting Ice.IPv6 property to 0.
    see:
    Let us know if that solve your problem.
    Regards,
    Jose
  • SukhiSukhi Member Sukhdeep SainiOrganization: UQProject: Developing context aware application for smartHome
    Hi Jose

    I am running on Vista 32 bit. Do I need to add the property in config.icebox?
    If yes, then it didn't worked and I am getting the same error. Below is the property:

    #
    #Ice.Trace.Network=1
    Ice.IPv6=0
    #
    # Protocol Tracing

    Thanks
    Sukhi
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    You need to set this property in the subscriber configuration.
  • SukhiSukhi Member Sukhdeep SainiOrganization: UQProject: Developing context aware application for smartHome
    Thanks Jose
  • SukhiSukhi Member Sukhdeep SainiOrganization: UQProject: Developing context aware application for smartHome
    Subscribing multiplr topics in one subscriber

    Hi

    I have a publisher which I run with multiple topics and need to subscribe to all the topics. How can I do so?

    Thanks
    Sukhi
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    In that case you will need to subscribe to each topic, you can use TopicManager.retrieveAll method to retrieve a dictionary of all existing topics and then iterate over the dictionary and subscribe to each topic.

    The Java code will look something like this:
    java.util.Map<String, IceStorm.TopicPrx> topics = manager.retrieveAll();
    for(java.util.Map.Entry<String, IceStorm.TopicPrx> entry : topics.entrySet())
    {
        try
        {
            entry.getValue().subscribeAndGetPublisher(qos, subscriber);
        }
        catch(IceStorm.AlreadySubscribed e)
        {
            //....
        }
        catch(IceStorm.BadQoS e)
        {
            //...
        }
    }
    

    How to handle the exceptions will depend on your program so i have omitted this part.
  • SukhiSukhi Member Sukhdeep SainiOrganization: UQProject: Developing context aware application for smartHome
    Need to return a value from proxy in subscriber.

    Hi Jose

    I have a below scenario taking the example of clock demo in subscriber:

    1. There is an inner class ClockI extends _ClockDisp.
    2. Say I need to return a value from the method tick inside it, somewhat like:

    public string tick(String date, Ice.Current current) {
    return date;
    }

    Below are my 2 questions:

    1. Can I do so? If yes then how to retrieve the value in run method of subscriber in below statement:

    communicator().waitForShutdown();

    2. When I change the return type from void to string in slice file and run the publisher I get below error: (Note: I don't have any compilation errors)

    operation = "tick"
    at Ice.ObjectPrxHelperBase.__checkTwowayOnly(ObjectPrxHelperBase.java:2172)
    at Demo.ClockPrxHelper.tick(ClockPrxHelper.java:52)
    at Demo.ClockPrxHelper.tick(ClockPrxHelper.java:29)
    at Sensor.run(Sensor.java:84)
    at Ice.Application.doMain(Application.java:214)
    at Ice.Application.main(Application.java:194)
    at Ice.Application.main(Application.java:118)



    Thanks
    Sukhi
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    IceStorm messages are unidirectional, that is, they must have void return type, cannot have out-parameters, and cannot raise user exceptions.

    See: IceStorm Concepts

    When using the publish/subscriber pattern like in IceStorm the application doesn't really know how many subscriber will receive the invocation. You must be aware that the same invocation will be send to all the topic subscribers, so will not make sense to have a return value here.

    If you need to return a value you have several options:
    • the subscribers can publish the reply to a specific topic see also Publishing to a Specific Subscriber
    • you can pass a callback that the subscribers can use to send the reply
    • use a twoway call without IceStorm.
Sign In or Register to comment.