![]() |
|
#1
|
|||
|
|||
|
Hi All,
I would like to retrieve the IP addresses from all connected client. I used: IApplicationInstance applicationInstance = client.getAppInstance(); MediaStreamMap msm = (MediaStreamMap) applicationInstance.getStreams(); String ip = (String) msm.getStream(streams.get(index)).getHTTPStreamerS ession().getIpAddress(); but it threw a NullPointerException. Can someone give me some advises? |
|
#2
|
|||
|
|||
|
Try it like this:
Code:
public void getClientIps(IClient client, RequestFunction function,
AMFDataList params) {
List<IClient> clients = client.getAppInstance().getClients();
Iterator<IClient> iter = clients.iterator();
while(iter.hasNext())
{
IClient aclient = iter.next();
if (!aclient.isConnected())
continue;
getLogger().info("Client IP" + aclient.getIp());
}
}
|
|
#3
|
|||
|
|||
|
Thank you Richard,
client.getIp() does well, but I am just curious about my code. did anything go wrong. Since I would like to retrieve the ip address corresponding to each stream. |
|
#4
|
|||
|
|||
|
Actually I think you want more that that, you also want the IP of all the HTTPStreamerSessions. I dont have the concise example right this minute, but take a look at this post and see if you can suss it out:
http://www.wowzamedia.com/forums/showthread.php?t=7097 Richard |
|
#5
|
|||
|
|||
|
Thank you Richard, you always been really helpful!!!
|
|
#6
|
|||
|
|||
|
Hi Richard,
I found a funny thing while I tried to get the MediaStreamMap. IApplicationInstance applicationInstance = client.getAppInstance(); MediaStreamMap msm = (MediaStreamMap) applicationInstance.getStreams(); msm contained all the connected streams, the funny thing is if only one stream in msm, it would just have one stream in the map. if there are two or more streams, each stream would have one duplicated stream. So say if there are 3 stream connected, there would have 6 streams in the msm. I wonder if you notice this? |
|
#7
|
|||
|
|||
|
Show the code you are using to count the number of streams.
Charlie |
|
#8
|
|||
|
|||
|
Here is my code:
public void getConnectedClientInfo(IClient client, RequestFunction function, AMFDataList params) { getLogger().info("getConnectedClinetInfo retrieving info....."); AMFDataArray retArray = new AMFDataArray(); AMFDataObj retObj = null; IApplicationInstance applicationInstance = client.getAppInstance(); List<String> streams = applicationInstance.getStreams().getPublishStreamN ames(); MediaStreamMap msm = (MediaStreamMap) applicationInstance.getStreams(); List<IMediaStream> streamList = new ArrayList<IMediaStream>(); streamList = msm.getStreams(); if(streamList.size()>0) { for(int i=0;i<streamList.size();i++) getLogger().info(streamList.size()+ ".."+streamList.get(i).getClientId()); } getLogger().info("MSM COUNTER"+msm.getCount()); for(int i=0;i<streams.size();i++){ getLogger().info(streams.get(i)+" Streams size: "+streams.size()); retObj = new AMFDataObj(); if(streams.get(i)!=null) { String str = new String(streams.get(i)); retObj.put("room", new AMFDataItem(str.substring(0,5))); getLogger().info("Room number: "+str.substring(0,5)); String id = str.substring(str.lastIndexOf("_")+1,str.length()) ; retObj.put("id", new AMFDataItem(id)); getLogger().info("User id : "+id); String printip = ""; getLogger().info(streamList.get(i).getClient().get Ip()); for(int a=0;a<streamList.size();a++){ int streamId = streamList.get(a).getClientId(); getLogger().info("Streams "+ id+" streamList: "+streamId); if(streamId==new Integer(id)) { String ip = (String) streamList.get(a).getClient().getIp(); printip = ip; retObj.put("ip", new AMFDataItem(ip)); } } getLogger().info("Room:"+str.substring(0,5)+" User ID:"+ id+" ip: "+printip); } retArray.add(retObj); } if(retArray!=null) sendResult(client, params, retArray); } Here is the Wowza log getConnectedClinetInfo retrieving info..... - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 4..1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 4..1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 4..1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 4..1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - MSM COUNTER4 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 99949_videoStream_1807759574 Streams size: 2 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Room number: 99949 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - User id : 1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 192.168.1.68 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1807759574 streamList: 1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1807759574 streamList: 1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1807759574 streamList: 1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1807759574 streamList: 1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Room:99949 User ID:1807759574 ip: 192.168.1.68 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 99949_videoStream_1015236877 Streams size: 2 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Room number: 99949 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - User id : 1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - 192.168.1.62 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1015236877 streamList: 1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1015236877 streamList: 1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1015236877 streamList: 1015236877 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Streams 1015236877 streamList: 1807759574 - - - 77.203 - - - - - - - - - - - - - - - - - - - - - - - - - 2010-02-11 14:37:19 NZDT comment server INFO 200 - Room:99949 User ID:1015236877 ip: 192.168.1.62 Last edited by lewyan13; 02-10-2010 at 06:07 PM. |
|
#9
|
|||
|
|||
|
Also, I have got another question about H.264. Wowza Media Server would encode the stream when gets it from client side and decode the stream when it pass to a destination. how do we know the server is using H.264?
Since we used red5 server before and just got into Wowza recently. The bandwidth of download or upload a stream is about the same as red5, so I am curious about how the wowza server uses the H264 to compress streams and reduce the bandwidth. |
|
#10
|
|||
|
|||
|
Actually, Wowza doesn't do any encoding, transcoding or compression.
Richard |
![]() |
| Thread Tools | |
| Display Modes | |
|
|