search
HomePHP FrameworkSwooleswoole method to get message sending failure error

swoole method to get message sending failure error

Dec 24, 2019 pm 04:23 PM
swoolemistake

swoole method to get message sending failure error

Send data to the client, function prototype:

bool Server->send(mixed $fd, string $data, int $serverSocket = -1);

The sending process is asynchronous, the bottom layer will automatically listen and write, and gradually send the data to the client

Parameters

$fd, the client’s file descriptor

$data, the data sent, the TCP protocol must not exceed 2M, buffer_output_size can be modified to change the maximum packet length allowed to be sent

$serverSocket, this parameter is required when sending data to the Unix Socket DGRAM peer. The TCP client does not need to fill in

Return value

If the sending is successful, true will be returned

Failure to send will return false. Call the $server->getLastError() method to get the failure error code

Server->getLastError

Get the latest Error code for an operation error. Business code can execute different logic based on error code types.

function Server->getLastError()

Returns an integer numeric error code

Send failure error

1001 The connection has been closed by the server, this error occurs Generally, $serv->close() has been executed in the code to close a certain connection, but $serv->send() is still called to send data to this connection.

1002 The connection has been closed by the client. The Socket has been closed and data cannot be sent to the peer

1003 Close is being executed, $serv->send() must not be used in the onClose callback function

1004 The connection has been closed

1005 The connection does not exist, and the incoming $fd may be wrong.

1007 Timeout data is received. After TCP closes the connection, some data may remain in the pipe buffer, and this part of the data will be Discard

1008 The send buffer is full and the send operation cannot be performed. This error indicates that the peer of this connection cannot receive data in time, causing the send buffer to be full

1202 The data sent exceeds server->buffer_output_size setting

Recommended learning: swoole video tutorial

The above is the detailed content of swoole method to get message sending failure error. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor