1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package tests
- import (
- "fmt"
- "net"
- "testing"
- jsoniter "github.com/json-iterator/go"
- )
- var json = jsoniter.ConfigCompatibleWithStandardLibrary
- func Test_DustData(t *testing.T) {
- data := "##$$$$ST=32;CN=2031;PW=123456;MN=yc;SK=ACE41F3D035D1F21EF16B96BFEDA418B;CP=&&DataTime=20200825094100;PM10-Avg=68.5,PM10-Flag=T;T01-Avg=31.1,T01-Flag=N;B03-Avg=18.1,B03-Flag=P;H01-Avg=50.3,H01-Flag=N;W01-Avg=231.1,W01-Flag=N;W02-Avg=2.4,W02-Flag=N;R01-Avg=231.1,R01-Flag=N;P01-Avg=101.1,P01-Flag=N;&&@@@@\r\n"
- conn, err := net.Dial("tcp", "47.108.135.38:11003")
- if err != nil {
- fmt.Println("connet err:", err)
- }
- conn.Write([]byte(data))
- //conn.Write([]byte(data))
- //conn.Write([]byte(data))
- conn.Close()
- }
- /*
- func Benchmark_DustData(t *testing.B) {
- conn, err := net.Dial("tcp", "47.108.135.38:11003")
- if err != nil {
- fmt.Println("connet err:", err)
- }
- dataFormart := "##$$$$ST=32;CN=2061;PW=123456;MN=yc;SK=ACE41F3D035D1F21EF16B96BFEDA418B;CP=&&DataTime=%d;PM10-Avg=68.5,PM10-Flag=T;T01-Avg=31.1,T01-Flag=N;B03-Avg=18.1,B03-Flag=P;H01-Avg=50.3,H01-Flag=N;W01-Avg=231.1,W01-Flag=N;W02-Avg=2.4,W02-Flag=N;R01-Avg=231.1,R01-Flag=N;P01-Avg=101.1,P01-Flag=N;&&@@@@\r\n"
- start := 20200808094101
- for i := 0; i < 100000; i++ {
- data := fmt.Sprintf(dataFormart, start+i)
- conn.Write([]byte(data))
- }
- conn.Close()
- }
- */
|