开发者

Java & JMF: how do I get the remote IP from a Participant?

开发者 https://www.devze.com 2023-02-04 02:39 出处:网络
I have t开发者_StackOverflowhe participant in an RTP Session, I need to get the IP address from that Participant.

I have t开发者_StackOverflowhe participant in an RTP Session, I need to get the IP address from that Participant.

How do I do that?

My imports, by request of one of the answerers:

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import javax.media.ControllerEvent;
import javax.media.ControllerListener;
import javax.media.DataSink;
import javax.media.Format;
import javax.media.Manager;
import javax.media.MediaException;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.media.Processor;
import javax.media.RealizeCompleteEvent;
import javax.media.format.AudioFormat;
import javax.media.protocol.ContentDescriptor;
import javax.media.protocol.DataSource;
import javax.media.rtp.Participant;
import javax.media.rtp.ReceiveStream;
import javax.media.rtp.ReceiveStreamListener;
import javax.media.rtp.SessionAddress;
import javax.media.rtp.SessionListener;
import javax.media.rtp.SessionManager;
import javax.media.rtp.event.NewParticipantEvent;
import javax.media.rtp.event.NewReceiveStreamEvent;
import javax.media.rtp.event.ReceiveStreamEvent;
import javax.media.rtp.event.SessionEvent;
import javax.media.rtp.rtcp.SourceDescription;


when a client connects to RTP server you will get a Socket and can use this method socket.getRemoteSocketAddress().toString(); to find the client IP address. For more detail post sample of your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消