On Fri, 2007-11-16 at 11:03 -0800, tjmcsorley wrote:
> I think I got it...
>
Yep, this is one way. You can also use custom implementations of the
NHttpServiceHandler or EventListener interface and cast the connection
object passed as a parameter to HttpInetConnection in order to find out
local or remote endpoints of that connection.
Hope this helps
Oleg
> SocketAddress local_isa = null;
> SocketAddress remote_isa = new InetSocketAddress(host, port);
> try
> {
> local_isa = new InetSocketAddress(InetAddress.getLocalHost(), 0);
> }
> catch (UnknownHostException e)
> {
> e.printStackTrace();
> }
> sessionRequest = ioReactor.connect(remote_isa, local_isa, this,
> new SessionRequestCallback()
> {
> public void cancelled(SessionRequest request) {
> System.out.println("cancelled...");
> }
>
> public void completed(SessionRequest request) {
> System.out.println("completed... LocalPort:" +
> request.getSession().getLocalAddress());
> }
>
> public void failed(SessionRequest request) {
> connectionFailed();
> }
>
> public void timeout(SessionRequest request) {
> System.out.println("timeout...");
> }
> }
> };
>
>
>
> tjmcsorley wrote:
> >
> > I'm using the NHTTPClient.java example code to build a test harness to
> > drive a considerable load against a Web Server. Some of the interactions
> > are exhibiting errors when the Web Server is stressed with many
> > simultaneous connections... How can I extract the local TCP port from a
> > connection so that I can correlate this with a network capture and then
> > isolate a particular connection for analysis?
> >
> > I've tried using the SessionRequest.getLocalAddress() method, however it
> > is always null...
> >
> > Reading through the GuidedTourOfHttpCore wiki page I see that somehow I
> > should be able to use the HttpInetConnection interface to possibly
> > accomplish this.
> >
> > But I don't see how to tie that into the NHTTPClient.java sample code.
> > Could you please provide an example on how to do this?
> >
> > Thanks!
> >
> > - tom
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]