tencent cloud

Performance Testing Service

Overview
Purchase Guide
Billing Overview
Pay-as-You-Go (postpaid)
Purchasing Channels
Payment Overdue
Refund Instructions
Quick Start
Operation Guide
Performance Testing in Simple Mode
Performance Testing in Script Mode
Performance Testing in JMeter Mode
Project Management
Scenario Management
Traffic Recording
Environment Management
Scheduled Performance Testing
Performance Testing Report
Access Control
Alarm Management
Tag Management
Error Code Manual
Practice Tutorial
Using Prometheus To Monitor Performance Testing Metrics
Using PTS to Playback Requests Recorded by GoReplay
API Documentation
History
Introduction
API Category
Making API Requests
PTS-related APIs
Data Types
Error Codes
JavaScript API List
Overview of JavaScript API List
pts/global
pts/http
pts
pts/dataset
pts/grpc
pts/jsonpath
pts/protobuf
pts/redis
pts/sql
pts/url
pts/util
pts/ws
pts/socketio
pts/socket
FAQs
Related Agreements
Service Level Agreement
Use Limits
Privacy Policy
Data Processing And Security Agreement

Conn.recv

PDF
Focus Mode
Font Size
Last updated: 2025-03-10 17:28:37
recv is used to receive data.
recv(size: number): ArrayBuffer

Parameters

Parameter
Type
Description
size
number
The limit on the maximum number of bytes that can be received.

Return

Type
Description
ArrayBuffer
Received binary data.

Samples

Receive the response data to the request.
import socket from "pts/socket";
import util from 'pts/util';

export default function () {
const tcp_socket = new socket.Conn('tcp', '127.0.0.1', 80);
const send_data = `GET /get HTTP/1.1
Host: 127.0.0.1
\\n`;
tcp_socket.send(util.toArrayBuffer(send_data));
tcp_socket.recv(512);
tcp_socket.close();
}


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback