1 下载Jmeter
https://mirror-hk.koddos.net/apache//jmeter/
2 开启Jmeter
3 添加线程组
4添加 TCP sampler
5添加View Tree
设置1个线程不断循环?
6设置线程组??
7设置Tcp sampers
?设置eolvalue=9,十进制,当tcp sampler 接收到服务器回复字节9的时候,开启下一次循环。发送21,539 字节。
?8开启测试
点击绿色三角形开始发送,点stop六边型停止
9服务器端java代码入下?
package com.suncreate.testSocket;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.*;
import java.util.Arrays;
public class SocketServer {
public static void main(String[] args) throws Exception {
// 监听指定的端口
int port = 55533;
ServerSocket server = new ServerSocket(port,50, InetAddress.getByAddress(new byte[]{(byte)172,16,37,(byte)162}));
System.out.println("waiting");
Socket socket = server.accept();
// 建立好连接后,从socket中获取输入流,并建立缓冲区进行读取
InputStream inputStream = socket.getInputStream();
OutputStream outputStream=socket.getOutputStream();
byte[] bytes = new byte[1024];
int len=0,total=0;
long second=0,start=System.currentTimeMillis();
while ((len = inputStream.read(bytes)) != -1) {
System.out.println(len);
total+=len;
second= (System.currentTimeMillis()-start)/1000;
if(second!=0)
System.out.println(total/second);
System.out.println("----------------------------------------");
outputStream.write(new byte[]{1,2,3,4,5,6,7,8,0x09});
outputStream.flush();
}
outputStream.close();
inputStream.close();
socket.close();
server.close();
}
}
10服务器输出如下
1024 24643128 ---------------------------------------- 1024 24643242 ---------------------------------------- 1024 24643356 ---------------------------------------- 1024 24643470 ---------------------------------------- 1024 24643584 ---------------------------------------- 1024 24643697 ---------------------------------------- 1024 24643811 ---------------------------------------- 1024 24643925 ---------------------------------------- 1024 24644039 ---------------------------------------- 1024 24644152 ---------------------------------------- 1024 24644266 ---------------------------------------- 1024 24644380 ---------------------------------------- 1024 24644494 ---------------------------------------- 1024 24644608 ---------------------------------------- 1024 24644721 ---------------------------------------- 1024 24644835 ---------------------------------------- 1024 24644949 ---------------------------------------- 1024 24645063 ---------------------------------------- 1024 24645176 ---------------------------------------- 1024 24645290 ---------------------------------------- 1024 24645404 ---------------------------------------- 1024 24645518 ---------------------------------------- 1024 24645632 ---------------------------------------- 1024 24645745 ---------------------------------------- 1024 24645859 ---------------------------------------- 1024 24645973 ---------------------------------------- 1024 24646087 ---------------------------------------- 1024 24646200 ---------------------------------------- 1024 24646314 ---------------------------------------- 1024 24646428 ---------------------------------------- 1024 24646542 ---------------------------------------- 1024 24646656 ---------------------------------------- 1024 24646769 ---------------------------------------- 1024 24646883 ---------------------------------------- 1024 24646997 ---------------------------------------- 1024 24647111 ---------------------------------------- 1024 24647224 ---------------------------------------- 1024 24647338 ---------------------------------------- 1024 24647452 ---------------------------------------- 1024 24647566 ---------------------------------------- 1024 24647680 ---------------------------------------- 1024 24647793 ---------------------------------------- 1024 24647907 ---------------------------------------- 1024 24648021 ---------------------------------------- 1024 24648135 ---------------------------------------- 1024 24648248 ---------------------------------------- 1024 24648362 ---------------------------------------- 1024 24648476 ---------------------------------------- 1024 24648590 ---------------------------------------- 1024 24648704 ---------------------------------------- 1024 24648817 ---------------------------------------- 1024 24648931 ---------------------------------------- 1024 24649045 ---------------------------------------- 1024 24649159 ---------------------------------------- 1024 24649272 ---------------------------------------- 1024 24649386 ---------------------------------------- 1024 24649500
https://testerhome.com/topics/2006
https://www.cnblogs.com/bf-blackfish/p/10579867.html
https://www.cnblogs.com/chenyun-/p/11714634.html
https://www.cnblogs.com/bf-blackfish/p/10579867.html
https://www.cnblogs.com/landhu/p/5488807.html
https://www.cnblogs.com/yiwangzhibujian/p/7107785.html
https://www.cnblogs.com/chenyun-/p/11714634.html
|