Sends ping packet to the server
NOTE: This may not work on some games (TF2 for example)

@throws InvalidPacketException
@throws SocketException

@return bool True on success, false on failure
483380
public function Ping( )
		{
			if( !$this->Connected )
			{
				throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
			}
			
			$this->Socket->Write( self::A2S_PING );
			$Buffer = $this->Socket->Read( );
			
			return $Buffer->GetByte( ) === self::S2A_PING;
		}
46986
public function send()
    {
        $this->client->notifyPlugins('beforeRequest', [$this]);
        if (isset($this->options['async'])) {
            $async = $this->options['async'];
            if (is_bool($async)) {
                $async = var_export($async, true);
            }
            $this->headers['x-arango-async'] = $async;
        }

        if (isset($this->options['isBatchPart']) && $this->options['isBatchPart'] === true) {
            //            $this->isBatchPart = true;
            $this->address = $this->client->endpoint . $this->path;

            //todo: Revisit this:
            return true;
        } else {
            if (null !== $this->options && (!array_key_exists(
                        'isBatchRequest',
                        $this->options
                    ) || (isset($this->options['isBatchRequest']) && $this->options['isBatchRequest'] !== true))
            ) {
                $this->headers['Content-Type'] = 'application/json';
            }
            $this->address  = $this->client->endpoint . $this->path;
            $this->response = $this->client->connector->send($this);
        }

        return $this->client->doRequest($this);
    }
1203967
public function ping() {

		$canConnect = false;

		foreach ( $this->httpRequests as $httpRequest ) {
			if ( !$httpRequest->ping() ) {
				return false;
			}

			$canConnect = true;
		}

		return $canConnect;
	}
1373262
public function accept()
    {
        $new = stream_socket_accept(
            $this->socket,
            $this->options['timeout_accept']
        );

        if (!$new) {
            throw new ConnectionException(socket_strerror(socket_last_error($new)));
        }
        
        socket_set_option(socket_import_stream($new), SOL_TCP, TCP_NODELAY, 1);

        return $new;
    }
1046834
public boolean send(Socket socket, int flags)
    {
        Utils.checkArgument(socket != null, "socket parameter must be set");
        return socket.send(data, flags);
    }
684445
protected function receive()
    {
        try {
            $data = $this->client->recv();

            if ($data === false) {
                $errorCode = $this->client->errCode;

                if ($errorCode == 11) {
                    throw new TransportException('Receive timeout in '.$this->getTimeout().' ms.',
                        TransportException::TIMEOUT);
                }

                throw new TransportException('Receive data failed, cause: '.socket_strerror($errorCode).'.',
                    TransportException::CONNECTION);
            } elseif ($data === '') {
                throw new TransportException('Receive data failed, cause the connection has been closed.',
                    TransportException::CONNECTION);
            }
        } catch (TransportException $e) {
            throw $e;
        } catch (Throwable $e) {
            if ($this->causedByTimeout($e)) {
                throw new TransportException('Receive timeout in '.$this->getTimeout().' ms.',
                    TransportException::TIMEOUT, $e);
            }

            throw new TransportException($e->getMessage(), 0, $e);
        }

        return $data;
    }
813615
public function send()
    {
        $providers = $this->providers;
        $messages = $this->messages;
        $this->unsetMessages();
        foreach ($messages as &$message) {
            foreach ($providers as $provider) {
                $message->using($provider)->send();
                if ($message->getStatus() == MessageStatus::STATUS_SENT) {
                    break;
                } else {
                    $this->addError($message->getError());
                }
            }
        }

        return $messages;
    }
490655
public function send($msg): bool
    {
        // JSON encode message if supplied in array or object form
        if (is_array($msg) || is_object($msg)) {
            $msg = json_encode($msg);
        }

        // Ensure message is a string
        $msg = (string) $msg;

        // Check the message fits within the buffer
        if (strlen($msg) > $this->buffer) {
            throw new SocketCommunicationException('Tried to send data larger than buffer size of '.$this->buffer.' bytes. Recreate channel with a larger buffer to send this data');
        }

        // Pad the message to the buffer size
        $msg = str_pad($msg, $this->buffer, ' ');

        // Write the message to the socket
        return socket_write($this->socket, $msg, $this->buffer);
    }
307430
private function send ()
		{
			if (count($this->_params) > 0)
				$this->_options[ CURLOPT_URL ] .= '?' . http_build_query($this->_params);

			if (count($this->_headers) > 0)
				$this->_options[ CURLOPT_HTTPHEADER ] = $this->_headers;

			$curl = curl_init();
			curl_setopt_array($curl, $this->_options);
			$resp = curl_exec($curl);

			if ($resp === false)
			{
				$this->_response = new CurlResponse([
					'status' => CurlResponse::S_SERVERERROR,
					'body'   => 'Error #' . curl_errno($curl) . ': ' . curl_error($curl)
				]);
			}
			else
			{
				$this->_response = new CurlResponse;
				$this->_response->fromCurl($resp, $curl);
			}

			curl_close($curl);

			return $this->_response;
		}
221074
public void send(Packet packet) {
        if (log.isTraceEnabled()) {
            log.trace("send packet: {}", packet);
        }
        // no handshake flag, queue the packet
        if (session.containsAttribute(Constants.HANDSHAKE_COMPLETE)) {
            try {
                // clear any queued items first
                queue.forEach(entry -> {
                    session.write(entry);
                    queue.remove(entry);
                });
            } catch (Exception e) {
                log.warn("Exception draining queued packets on session: {}", session.getId(), e);
            }
            // process the incoming packet
            session.write(packet);
        } else {
            if (handshakeWriteFuture != null) {
                log.warn("Handshake is not complete yet on session: {} written? {}", session.getId(), handshakeWriteFuture.isWritten(), handshakeWriteFuture.getException());
            } else {
                log.warn("Handshake is not complete yet on session: {}", session.getId());
            }
            // not queuing pings
            MessageType type = packet.getType();
            if (type != MessageType.PING && type != MessageType.PONG) {
                log.info("Placing {} message in session: {} queue", type, session.getId());
                queue.offer(packet);
            }
        }
    }
360132
public function send()
    {
        return $this->client->executeRequest(
            new OutboundSMSRequest(
                $this->message,
                $this->recipientNumber,
                $this->senderNumber,
                $this->senderName
            )
        );
    }
832292
public function send()
    {

        if (headers_sent()) {
            throw new HttpException(Response::STATUS_INTERNAL_SERVER_ERROR, 'Headers already send');
        }

        header($this->getStatusLine());

        foreach ($this->headers as $header) {
            header($header);
        }

        echo $this->body;
    }
49544
public function sendPacket(Packet $packet)
    {
        // Create a raw packet
        $rawPacket = $packet->convertToRcon();

        // Attach size
        $rawPacket = pack('V', mb_strlen($rawPacket)).$rawPacket;

        // Write to the socket
        $this->socket->write($rawPacket);

        // Read the packet size
        $packetSize = $this->socket->read(4);
        $packetSize = unpack('V', $packetSize);
        $packetSize = reset($packetSize);

        // TODO: multi-packet responses

        // Read the packet
        $rawPacket = $this->socket->read($packetSize);

        // Parse and return the packet
        return Packet::createFromRcon($rawPacket);
    }
1304466
public static function ping()
    {
        self::init();

        //====================================================================//
        // Simple Message reply, No Encryption
        Splash::log()->msg("Ping Successful.");
        self::$Outputs->result = true;

        //====================================================================//
        // Transmit Answer with No Encryption
        return Splash::ws()->pack(self::$Outputs, true);
    }
1054455
protected function sendRequest()
    {
        try {
            $this->response = $this->client->send($this->request);
        } catch (RequestException $e) {
            $this->response = $e->getResponse();

            if (null === $this->response) {
                if ($this->throwsRequestException) {
                    throw $e;
                }
            }

            if ($this->throwsRequestException) {
                throw new \Exception((string)$this->response->getBody());
            }
        }
    }
726853
public function send()
    {
        $transport = $this->getConnection()->getTransportObject();

        // Refactor: Not full toArray needed in exec?
        return $transport->exec($this, $this->getConnection()->toArray());
    }
1346637
public function sendPing()
    {
        $msgId = $this->createIqId();
        $pingNode = new ProtocolNode('ping', null, null, null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'xmlns' => 'w:p',
                'type'  => 'get',
                'to'    => Constants::WHATSAPP_SERVER,
            ], [$pingNode], null);

        $this->sendNode($node);
    }