<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
--></style><title>Re: [Live-devel] Close specified client by
IP</title></head><body>
<blockquote type="cite" cite><font face="Arial" size="-1">I have
written a control panel to control Live555 VOD server, in this panel,
administrator could see active connection's IP addresses, I want to
close some specified connections by IP address, now the RTSPServer can
receive these specified IP addresses, but how could I close these
connections in RTSPServer.cpp?</font></blockquote>
<div><br></div>
<div>You can cleanly close a connection - within the "RTSPServer"
- simply by deleting its "RTSPClientSession" object.
Therefore, all you need is a way of mapping "client IP
address"+"client port number" to
"RTSPClientSession".</div>
<div><br></div>
<div>(Note that just knowing the client's IP address is not enough,
because it's possible for more than one connection to come from the
same IP address. You will need to use the client's port number
as well.)</div>
<div><br></div>
<div>I suggest that you subclass "RTSPServer" to add a hash
table that maps "client IP address"+"client port
number" to "RTSPClientSession". Redefine the
"createNewClientSession()" virtual function to add an entry
into this hash table each time that you create a new
"RTSPClientSession" object. Also, whenever you delete
a "RTSPClientSession" object (to close its connection),
remove the corresponding hash table entry.</div>
<div><br></div>
<div>As always, you should be able to do this just via subclassing -
without modifying any of the supplied "LIVE555" code.</div>
<x-sigsep><pre>--
</pre></x-sigsep>
<div><br>
Ross Finlayson<br>
Live Networks, Inc.<br>
http://www.live555.com/</div>
</body>
</html>