You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Ed Young <ej...@summitbid.com> on 2009/05/06 22:56:30 UTC

getting a TCP Sampler's socket port number

In the TCP Sampler Config node, I specify the target ip and port for my
request. JMeter must be instantiating a socket for this request. How can I
get a handle to the socket or the port number for the socket?

If I could get a handle to the socket, I could make a call to getLocalPort()
using beanshell.

Re: getting a TCP Sampler's socket port number

Posted by "Jean-Louis.Pasturel" <je...@orange.fr>.
sebb a écrit :

>On 06/05/2009, Ed Young <ej...@summitbid.com> wrote:
>  
>
>>In the TCP Sampler Config node, I specify the target ip and port for my
>> request. JMeter must be instantiating a socket for this request. How can I
>> get a handle to the socket or the port number for the socket?
>>
>> If I could get a handle to the socket, I could make a call to getLocalPort()
>> using beanshell.
>>
>>    
>>
>
>Beanshell has access to the sampler, so check the Javadoc to see if
>there is a suitable API.
>If not, have a look at the source in case there is another way to access it.
>
>Failing that, you will need to write your own code - if you are able
>to write Beanshell code, it should not be difficult to amend one of
>the TCP Client implementations and use that.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>---------------------------------------------------------------------------------------
>Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
>Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
>  
>
The Socket constructor to use is

*java.net.Socket.Socket( *|InetAddress <ci...@orange.fr> address,
       int port,
       InetAddress <ci...@orange.fr> localAddr,
       int localPort)
I have writen a basic JMeter Java Request that handles multiple local IP Addresses 
( for a need of IP Spoofing) with this classe.
 
|



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: getting a TCP Sampler's socket port number

Posted by sebb <se...@gmail.com>.
On 06/05/2009, Ed Young <ej...@summitbid.com> wrote:
> In the TCP Sampler Config node, I specify the target ip and port for my
>  request. JMeter must be instantiating a socket for this request. How can I
>  get a handle to the socket or the port number for the socket?
>
>  If I could get a handle to the socket, I could make a call to getLocalPort()
>  using beanshell.
>

Beanshell has access to the sampler, so check the Javadoc to see if
there is a suitable API.
If not, have a look at the source in case there is another way to access it.

Failing that, you will need to write your own code - if you are able
to write Beanshell code, it should not be difficult to amend one of
the TCP Client implementations and use that.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org