Results 1 to 10 of 10

Thread: How to get the host name and ip

  1. #1

    Default How to get the host name and ip

    I've done some searching, gone through the docs and played around and it's not obvious to me so I thought I would quickly ask in case somebody knows.

    How do I get the host name and IP of the host server of Wowza through server side code? I want to get these values on the application start (onAppStart)

    Thanks
    Graeme

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    You could set them in Application.xml Property settings. I don't think Wowza has a way of knowing what hostname a server is reachable through, or the IP addresses, unless they are set in a VHost /HostPort /IpAddress, in which case there is probably some way.

    Richard

  3. #3

    Default

    I was wondering if I would need to do that. That sucks, I would have rather it be dynamic so that I don't have to make a custom Application.xml file for every server we have.

  4. Default

    Couldn't you just define those values as properties in Vhost.xml, and then read them using application.getVhost.getProperties() ?

  5. #5

    Default

    From the vhost interface you can get the list of HostPorts:

    HostPortList hostPortList = appInstance.getVHost().getHostPortsList();
    Charlie

  6. #6
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Yes, setting a Property in a VHost.xml or Server.xml will work to avoid maintaining per app

    Richard

  7. #7

    Default

    Yes, I realize I *can* do that, but I didn't want to. It would be awesome if I could just get it dynamically.

    Feature request!!

  8. #8
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    You can use a hostname in HostPort /IpAddress, and you can get all HostPorts in Charlie's example, then you should be able to look at each HostPort IpAddress. If it is set using a hostname you can get that.

    HostPortList hostPortList = appInstance.getVHost().getHostPortsList();
    
    for (int i=0;i<hostPortList.size();i++)
    {
    	HostPort port =hostPortList.get(i);
    	String ip = port.getAddressStr();
    }

  9. #9

    Default

    Thanks Richard. When I output it I get:

    INFO server comment - ip: + [any]
    INFO server comment - ip: + [any]

    Getting there. I think for now I'll stick it in the vhost xml file. It's not too bad of a solution.

  10. #10
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    I think this means you have the default "*" in the HostPort IpAddress fields, i.e., any IP address. The suggestion is to replace the "*" with a hostname (that resolves to a ip on that machine), then it should show up.

    Richard

Similar Threads

  1. I can use live repeater with local host
    By hungnguyen88 in forum Live Streaming and Encoders
    Replies: 2
    Last Post: 09-29-2014, 07:18 PM
  2. Strange host errors on startup
    By hdezela in forum Wowza Media Server 3 for Amazon EC2 Discussion
    Replies: 2
    Last Post: 02-14-2013, 05:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •